tfrere's picture
tfrere HF Staff
feat(hero): persistent Edit + Delete buttons on the banner
55f5851
/* ============================================================================ */
/* Hero + Meta bar */
/* Extracted from HeroArticle.astro scoped styles. */
/* Shared between editor (FrontmatterHero.tsx) and publisher (html-renderer). */
/* ============================================================================ */
/* ---- Hero section ---- */
.hero {
width: 100%;
padding: 64px 16px 16px;
text-align: center;
}
.hero-title {
font-size: clamp(34px, 5vw, 54px);
font-weight: 800;
line-height: 1.12;
letter-spacing: -0.02em;
margin: 0 auto 8px;
max-width: 780px;
text-wrap: balance;
}
.hero-title[data-title-size="md"] {
font-size: clamp(28px, 4vw, 44px);
}
.hero-title[data-title-size="sm"] {
font-size: clamp(24px, 3.2vw, 38px);
}
.hero-banner {
max-width: 980px;
margin: 0 auto;
aspect-ratio: 5 / 2;
overflow: hidden;
}
.hero-banner iframe {
background: transparent;
}
/* Filled banner: hosts the iframe AND the action button cluster. */
.hero-banner--filled {
position: relative;
}
/* Edit + Remove buttons are always visible (not hover-gated): the
request from the author flow is to make banner mutation a first-
class affordance, not a discover-on-hover surprise. Grouped in a
single cluster top-right so screen-readers can navigate them as a
pair and the shared backdrop reads well over any iframe content
(image, chart, gradient). */
.hero-banner-actions {
position: absolute;
top: 8px;
right: 8px;
display: inline-flex;
align-items: center;
gap: 4px;
z-index: 2;
}
.hero-banner-action {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
padding: 0;
border: 1px solid var(--border-color);
border-radius: 6px;
background: var(--surface-bg, rgba(0, 0, 0, 0.6));
color: var(--text-color);
cursor: pointer;
transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.hero-banner-action:hover,
.hero-banner-action:focus-visible {
border-color: var(--text-color);
background: var(--surface-bg, rgba(0, 0, 0, 0.8));
outline: none;
}
.hero-banner-action--danger:hover,
.hero-banner-action--danger:focus-visible {
border-color: var(--ed-error, #d32f2f);
color: var(--ed-error, #d32f2f);
}
/* Empty-banner placeholder: shown when the article has no banner set.
Keeps the same aspect-ratio as a real banner so the layout doesn't jump
when a user uploads an image or generates a chart. */
.hero-banner--empty {
display: flex;
align-items: center;
justify-content: center;
border: 1px dashed var(--border-color);
border-radius: 8px;
background: var(--surface-bg, transparent);
transition: border-color 120ms ease, background 120ms ease;
}
.hero-banner--empty:hover {
border-color: var(--text-color);
}
.hero-banner-empty__inner {
display: flex;
flex-direction: column;
align-items: center;
gap: 14px;
padding: 24px;
text-align: center;
}
.hero-banner-empty__hint {
margin: 0;
color: var(--muted-color);
font-size: 14px;
}
.hero-banner-empty__actions {
display: flex;
gap: 8px;
flex-wrap: wrap;
justify-content: center;
}
.hero-banner-empty__actions .btn {
display: inline-flex;
align-items: center;
gap: 6px;
}
.hero-desc {
color: var(--muted-color);
font-style: italic;
margin: 0 auto 16px;
max-width: 55%;
}
@media (max-width: 768px) {
.hero-banner { aspect-ratio: auto; }
.hero-desc { max-width: 90%; }
}
/* ---- Meta bar ---- */
.meta {
border-top: 1px solid var(--border-color);
border-bottom: 1px solid var(--border-color);
padding: 1rem 0;
font-size: 0.9rem;
}
.meta-container {
max-width: 980px;
display: flex;
flex-direction: row;
justify-content: space-between;
margin: 0 auto;
padding: 0 var(--content-padding-x, 16px);
gap: 8px;
flex-wrap: wrap;
row-gap: 12px;
}
.meta-container a:not(.button) {
color: var(--primary-color);
text-decoration: underline;
text-underline-offset: 2px;
text-decoration-thickness: 0.06em;
text-decoration-color: var(--link-underline);
transition: text-decoration-color 0.15s ease-in-out;
}
.meta-container a:hover {
text-decoration-color: var(--link-underline-hover);
}
.meta-container-cell {
display: flex;
flex-direction: column;
gap: 8px;
max-width: 400px;
}
.meta-container-cell h3 {
margin: 0;
font-size: 12px;
font-weight: 400;
color: var(--muted-color);
text-transform: uppercase;
letter-spacing: 0.02em;
}
.meta-container-cell p {
margin: 0;
}
.authors {
margin: 0;
list-style-type: none;
padding-left: 0;
display: flex;
flex-wrap: wrap;
}
.authors li {
white-space: nowrap;
padding: 0;
}
.affiliations {
margin: 0;
padding-left: 1.25em;
}
.affiliations li {
margin: 0;
}
@media (max-width: 768px) {
.meta-container-cell:nth-child(even) { text-align: right; }
.meta-container-cell:last-child:nth-child(odd) {
flex-grow: 0;
flex-basis: auto;
margin-left: auto;
text-align: right;
}
}