StealThis .dev
Pages Hard

Blog Magazine

Modern blog layout with dark/light theme transitions, animated typography, and reading-view article cards.

Open in Lab
gsaplenissplittextview-transitions-api
Targets: JS HTML

Code

/* ═══════════════════════════════════════════════════════════════════
   BLOG MAGAZINE — styles.css
   Dual-theme editorial layout with View Transitions API support
   ═══════════════════════════════════════════════════════════════════ */

/* ── Theme Tokens ─────────────────────────────────────────────────── */

[data-theme="dark"] {
  --page-bg: #111118;
  --page-surface: #1a1a24;
  --page-border: #2a2a3a;
  --page-text: #e8e8f0;
  --page-muted: #8888a0;
  --page-accent: #7c6cff;
  --page-accent-warm: #ff7eb3;
  --page-code-bg: #1e1e2e;
}

[data-theme="light"] {
  --page-bg: #f8f7f4;
  --page-surface: #ffffff;
  --page-border: #e0ddd6;
  --page-text: #1a1a24;
  --page-muted: #6a6a78;
  --page-accent: #5a4cd4;
  --page-accent-warm: #d4507a;
  --page-code-bg: #f0eff0;
}

/* ── View Transition Animations ───────────────────────────────────── */

::view-transition-new(root) {
  animation: vt-wipe 0.5s ease-in-out;
  clip-path: circle(0% at var(--wipe-x) var(--wipe-y));
}

@keyframes vt-wipe {
  to {
    clip-path: circle(var(--wipe-radius) at var(--wipe-x) var(--wipe-y));
  }
}

::view-transition-old(root) {
  animation: none;
}

/* ── Reset & Base ─────────────────────────────────────────────────── */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--page-bg);
  color: var(--page-text);
  font-family: Georgia, 'Times New Roman', 'Noto Serif', serif;
  line-height: 1.7;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: var(--page-accent);
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ── UI Font (metadata, labels, buttons) ──────────────────────────── */

.category-tag,
.reading-time,
.card-footer,
.card-author,
.card-date,
.btn-read,
.newsletter-btn,
.newsletter-input,
.theme-toggle,
.card-close-btn,
.site-footer {
  font-family: 'SF Pro Display', 'Inter', system-ui, sans-serif;
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 1: MASTHEAD
   ═══════════════════════════════════════════════════════════════════ */

.masthead {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: 6rem 2rem 4rem;
  text-align: center;
}

.masthead-inner {
  max-width: 720px;
}

.masthead-title {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--page-text);
  margin-bottom: 1rem;
}

.masthead-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  color: var(--page-muted);
  font-style: italic;
  letter-spacing: 0.01em;
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 5.5rem;
  z-index: 10000;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--page-border);
  background: var(--page-surface);
  color: var(--page-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.theme-toggle:hover {
  border-color: var(--page-accent);
  transform: scale(1.08);
}

/* Show sun in dark mode, moon in light mode */
[data-theme="dark"] .theme-icon--sun { display: block; }
[data-theme="dark"] .theme-icon--moon { display: none; }
[data-theme="light"] .theme-icon--sun { display: none; }
[data-theme="light"] .theme-icon--moon { display: block; }

/* ═══════════════════════════════════════════════════════════════════
   SECTION 2: FEATURED ARTICLE
   ═══════════════════════════════════════════════════════════════════ */

.featured {
  padding: 0 2rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.featured-card {
  background: var(--page-surface);
  border: 1px solid var(--page-border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.3s, background 0.3s;
}

.featured-card:hover {
  border-color: var(--page-accent);
}

.featured-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.featured-gradient {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--page-accent), var(--page-accent-warm));
  opacity: 0.85;
  transition: opacity 0.4s;
}

.featured-card:hover .featured-gradient {
  opacity: 1;
}

.featured-body {
  padding: 2rem 2.5rem 2.5rem;
}

.featured-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.category-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: color-mix(in srgb, var(--page-accent) 15%, transparent);
  color: var(--page-accent);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.reading-time {
  font-size: 0.8rem;
  color: var(--page-muted);
}

.featured-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--page-text);
}

.featured-excerpt {
  font-size: 1.05rem;
  color: var(--page-muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  max-width: 640px;
}

.btn-read {
  display: inline-block;
  padding: 0.75rem 1.8rem;
  background: var(--page-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.2s;
}

.btn-read:hover {
  background: color-mix(in srgb, var(--page-accent) 85%, #000);
  transform: translateY(-1px);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 3: ARTICLE GRID
   ═══════════════════════════════════════════════════════════════════ */

.articles-section {
  padding: 2rem 2rem 6rem;
  max-width: 1100px;
  margin: 0 auto;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  transition: all 0.4s ease;
}

/* Individual article card */
.article-card {
  background: var(--page-surface);
  border: 1px solid var(--page-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s, background 0.3s;
  position: relative;
}

.article-card:hover {
  border-color: var(--page-accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Card gradient headers */
.card-gradient {
  height: 140px;
  transition: height 0.4s ease;
}

.card-gradient--indigo {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.card-gradient--emerald {
  background: linear-gradient(135deg, #11998e, #38ef7d);
}

.card-gradient--amber {
  background: linear-gradient(135deg, #f093fb, #f5576c);
}

.card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.card-body .category-tag {
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.6rem;
  color: var(--page-text);
}

.card-excerpt {
  font-size: 0.9rem;
  color: var(--page-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--page-muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--page-border);
}

.card-author {
  font-weight: 600;
  color: var(--page-text);
}

/* Full article content (hidden by default) */
.card-full-content {
  display: none;
  padding: 0 1.5rem 1.5rem;
}

.card-full-content p {
  font-size: 1rem;
  color: var(--page-text);
  line-height: 1.8;
  margin-bottom: 1.25rem;
}

.card-full-content p:last-child {
  margin-bottom: 0;
}

/* Close button (hidden by default) */
.card-close-btn {
  display: none;
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  z-index: 10;
  transition: background 0.2s, transform 0.2s;
  align-items: center;
  justify-content: center;
}

.card-close-btn:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1.1);
}

/* ── Reading View ─────────────────────────────────────────────────── */

.articles-grid.has-reading-view {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.articles-grid.has-reading-view .article-card {
  display: none;
}

.articles-grid.has-reading-view .article-card.reading-view {
  display: block;
  width: 100%;
  max-width: 680px;
  cursor: default;
  transform: none;
  box-shadow: 0 8px 60px rgba(0, 0, 0, 0.12);
}

.article-card.reading-view:hover {
  transform: none;
}

.article-card.reading-view .card-gradient {
  height: 100px;
}

.article-card.reading-view .card-title {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.article-card.reading-view .card-excerpt {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.article-card.reading-view .card-full-content {
  display: block;
}

.article-card.reading-view .card-close-btn {
  display: flex;
}

.article-card.reading-view .card-footer {
  margin: 0 1.5rem;
  padding-bottom: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 4: NEWSLETTER CTA
   ═══════════════════════════════════════════════════════════════════ */

.newsletter {
  position: relative;
  overflow: hidden;
  padding: 6rem 2rem;
  text-align: center;
  background: var(--page-surface);
  border-top: 1px solid var(--page-border);
}

.newsletter-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.2;
  pointer-events: none;
}

.newsletter-orb--1 {
  width: 400px;
  height: 400px;
  background: var(--page-accent);
  top: -100px;
  left: -80px;
}

.newsletter-orb--2 {
  width: 350px;
  height: 350px;
  background: var(--page-accent-warm);
  bottom: -120px;
  right: -60px;
}

.newsletter-inner {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
}

.newsletter-heading {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--page-text);
}

.newsletter-subtitle {
  font-size: 0.95rem;
  color: var(--page-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.newsletter-form {
  display: flex;
  gap: 0.75rem;
  max-width: 420px;
  margin: 0 auto;
}

.newsletter-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--page-bg);
  border: 1px solid var(--page-border);
  border-radius: 8px;
  color: var(--page-text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.newsletter-input::placeholder {
  color: var(--page-muted);
}

.newsletter-input:focus {
  border-color: var(--page-accent);
}

.newsletter-btn {
  padding: 0.75rem 1.5rem;
  background: var(--page-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s, transform 0.2s;
}

.newsletter-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--page-accent) 85%, #000);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════ */

.site-footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.8rem;
  color: var(--page-muted);
  border-top: 1px solid var(--page-border);
}

/* ═══════════════════════════════════════════════════════════════════
   DEMO SHELL OVERRIDES FOR LIGHT THEME
   ═══════════════════════════════════════════════════════════════════ */

[data-theme="light"] .demo-shell-back {
  background: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: var(--page-accent) !important;
}

[data-theme="light"] .demo-shell-back:hover {
  background: rgba(255, 255, 255, 1) !important;
  border-color: rgba(0, 0, 0, 0.25) !important;
}

[data-theme="light"] .demo-shell-info {
  background: rgba(248, 247, 244, 0.95) !important;
  border-top-color: rgba(0, 0, 0, 0.08) !important;
  color: var(--page-muted) !important;
}

[data-theme="light"] .demo-shell-info .demo-title {
  color: var(--page-text) !important;
}

[data-theme="light"] .demo-shell-info .demo-tag {
  background: color-mix(in srgb, var(--page-accent) 10%, transparent) !important;
  border-color: color-mix(in srgb, var(--page-accent) 25%, transparent) !important;
  color: var(--page-accent) !important;
}

[data-theme="light"] .motion-toggle {
  background: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: var(--page-accent) !important;
}

[data-theme="light"] .motion-toggle:hover {
  background: rgba(255, 255, 255, 1) !important;
  border-color: rgba(0, 0, 0, 0.25) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════ */

.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
  transition-duration: 0s !important;
  animation-duration: 0s !important;
}

.reduced-motion .article-card,
.reduced-motion .featured-card {
  transform: none !important;
  opacity: 1 !important;
}

.reduced-motion .masthead-title,
.reduced-motion .masthead-subtitle,
.reduced-motion .featured-title,
.reduced-motion .newsletter-heading {
  opacity: 1 !important;
  transform: none !important;
}

.reduced-motion ::view-transition-new(root),
.reduced-motion ::view-transition-old(root) {
  animation: none !important;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .articles-grid {
    grid-template-columns: 1fr;
  }

  .masthead {
    min-height: 40vh;
    padding: 5rem 1.25rem 3rem;
  }

  .featured {
    padding: 0 1rem 3rem;
  }

  .featured-body {
    padding: 1.5rem;
  }

  .featured-image {
    aspect-ratio: 4 / 3;
  }

  .articles-section {
    padding: 2rem 1rem 4rem;
  }

  .card-body {
    padding: 1rem 1.25rem 1.25rem;
  }

  .card-full-content {
    padding: 0 1.25rem 1.25rem;
  }

  .newsletter {
    padding: 4rem 1.25rem;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .newsletter-btn {
    width: 100%;
  }

  .theme-toggle {
    right: 4.5rem;
    width: 36px;
    height: 36px;
  }

  .article-card.reading-view .card-title {
    font-size: 1.3rem;
  }
}

Blog Magazine

Modern blog layout with dark/light theme transitions, animated typography, and reading-view article cards.

Source

  • Repository: libs-genclaude
  • Original demo id: 27-blog-magazine

Notes

Modern blog layout with dark/light theme transitions, animated typography, and reading-view article cards.