/* Custom theme overrides for cristianmihai.com. Loaded after app.css. */

/* ===== NAVBAR AUTH BUTTONS ===== */
.m-nav-btn {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin-left: 0.4rem;
}

.m-nav-btn--signin {
  color: var(--secondary-foreground-color);
  background: transparent;
}

.m-nav-btn--signin:hover {
  color: var(--brand-accent);
}

.m-nav-btn--subscribe {
  color: #fff;
  background: var(--brand-accent);
}

.m-nav-btn--subscribe:hover {
  background: #4da3cb;
}

.m-nav-btn--account {
  color: var(--secondary-foreground-color);
  border: 1px solid var(--primary-border-color);
  background: transparent;
}

.m-nav-btn--account:hover {
  border-color: var(--brand-accent);
  color: var(--brand-accent);
}

/* Prevent navbar items from wrapping */
.m-nav__right {
  flex-wrap: nowrap;
}

/* Below 48rem the toggle is fixed-positioned (floating), so buttons have room */
@media only screen and (max-width: 47.9375rem) {
  .m-nav-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    margin-left: 0.25rem;
  }
}

/* 48rem–64rem: toggle is inline, space is tight — compact everything */
@media only screen and (min-width: 48rem) and (max-width: 63.9375rem) {
  .m-nav-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.55rem;
    margin-left: 0.3rem;
  }
  .m-toggle-darkmode {
    margin-left: 10px !important;
  }
}

/* ===== THEME TRANSITION ===== */
html[data-theme] body,
html[data-theme] body * {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Disable transitions on initial page load to prevent flash */
html[data-theme].no-transitions body,
html[data-theme].no-transitions body * {
  transition: none !important;
}

/* ===== ACCESSIBILITY: FOCUS STATES ===== */
*:focus-visible {
  outline: 2px solid var(--brand-accent, #5FB6DE);
  outline-offset: 2px;
}

/* ===== BRAND COLORS ===== */
:root {
  --primary-subtle-color: #5FB6DE !important;
  --brand-accent: #5FB6DE;
  --brand-dark: #141836;
  --brand-dark-light: #1e2348;
  --font-heading: 'Oswald', sans-serif;
  --font-body: 'Raleway', sans-serif;
  --font-story: var(--font-body);
  --meta-text-color: #6b6b6b;
  --motion-fast: 160ms;
  --motion-soft: 320ms;
  --motion-slow: 720ms;
  --ease-editorial: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snap: cubic-bezier(0.2, 0.8, 0.2, 1);
  --story-paper-light: #fbfaf7;
  --story-paper-dark: #131629;
  --story-line-light: rgba(20, 24, 54, 0.08);
  --story-line-dark: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
  --footer-background-color: #141836;
  --link-color: #141836;
  --primary-subtle-color: #5FB6DE !important;
}

[data-theme="dark"] {
  --primary-subtle-color: #5FB6DE !important;
  --link-color: #8ecfeb;
  --footer-background-color: #0c0e24;
  --background-color: #111422;
  --meta-text-color: #9a9ab0;
}

/* ===== TYPOGRAPHY ===== */
body {
  font-family: var(--font-body);
}

h1, h2, h3, h4, h5, h6,
.m-hero-title,
.m-heading__title,
.m-featured-article__title,
.m-article-card__title,
.m-story-card__title,
.m-section-title,
.m-stories-section-title,
.m-blog-teaser-title {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Long-form reading uses Raleway, tuned separately from display titles. */
.m-story-content .js-post-content > *:not(.kg-card):not(.m-share):not(.m-tags):not(.m-story-end) {
  font-family: var(--font-story);
}

.l-post-content .js-post-content p,
.l-post-content .js-post-content li,
.l-post-content .js-post-content blockquote,
.l-post-content .js-post-content figcaption,
.l-post-content .js-post-content table {
  font-family: var(--font-body);
}

.l-post-content .js-post-content p,
.l-post-content .js-post-content li {
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.005em;
  line-height: 1.78;
}

.l-post-content .js-post-content p {
  margin-bottom: 1.55em;
}

.m-story-content .js-post-content p {
  font-size: 1.08rem;
  font-weight: 400;
  letter-spacing: 0.005em;
  line-height: 1.95;
  margin-bottom: 1.65em;
}

.m-story-content .js-post-content blockquote {
  font-family: var(--font-story);
  font-style: italic;
  border-left: 3px solid var(--brand-accent);
}

/* ===== STORY CARDS (homepage) ===== */
.m-stories-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.m-story-card {
  display: flex;
  flex-direction: column;
  background: var(--background-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--article-shadow-normal);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.m-story-card:hover {
  box-shadow: var(--article-shadow-hover);
  transform: translateY(-2px);
}

.m-story-card__picture {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.m-story-card__picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.m-story-card:hover .m-story-card__picture img {
  transform: scale(1.03);
}

.m-hero__picture picture,
.m-featured-article__picture picture {
  display: block;
  height: 100%;
  width: 100%;
}

.m-featured-article__picture-background {
  display: block;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
  width: 100%;
}

.m-story-card__content {
  padding: 1.5rem 1.75rem 1.75rem;
}

.m-story-card__featured-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-accent);
  margin-bottom: 0.75rem;
  max-width: max-content;
  width: fit-content;
  white-space: nowrap;
}

.m-story-card__members-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-accent);
  margin-bottom: 0.75rem;
  margin-left: 0.75rem;
  max-width: max-content;
  width: fit-content;
  white-space: nowrap;
}

.m-story-card__featured-badge + .m-story-card__members-badge {
  margin-left: 0.75rem;
}

.m-story-card__content > .m-story-card__members-badge:first-child {
  margin-left: 0;
}

.m-story-card__link {
  text-decoration: none;
  color: inherit;
}

.m-story-card__title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.75rem 0;
  color: var(--secondary-foreground-color);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.m-story-card__excerpt {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--primary-foreground-color);
  margin: 0 0 1rem 0;
  font-weight: 400;
}

.m-story-card__meta {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--meta-text-color, #6b6b6b);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.m-story-card__tag {
  color: var(--brand-accent);
  text-decoration: none;
  font-weight: 500;
}

.m-story-card__tag:hover {
  text-decoration: underline;
}

/* ===== STORIES SECTION HEADER ===== */
.m-stories-section-header {
  text-align: center;
  margin: 2.5rem 0 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--primary-border-color);
}

.m-stories-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--secondary-foreground-color);
  margin: 0 0 0.5rem 0;
}

.m-stories-section-description {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--meta-text-color, #6b6b6b);
  margin: 0;
}

/* ===== BLOG TEASER SECTION (on homepage) ===== */
.m-blog-teaser-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--primary-border-color);
}

.m-blog-teaser-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.5rem;
  padding: 0;
}

.m-blog-teaser-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--secondary-foreground-color);
  margin: 0;
}

.m-blog-teaser-link {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--brand-accent);
  text-decoration: none;
  font-weight: 500;
}

.m-blog-teaser-link:hover {
  text-decoration: underline;
}

/* ===== STORY POST LAYOUT ===== */
.m-story-article .l-post-content {
  max-width: 720px;
  margin: 0 auto;
}

.m-story-heading {
  text-align: center;
  margin-bottom: 2rem;
}

.m-story-title {
  font-family: var(--font-heading) !important;
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.m-story-meta {
  font-family: var(--font-body);
  justify-content: center;
  color: var(--meta-text-color, #6b6b6b);
}

.m-story-members-label {
  color: var(--brand-accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.m-story-end {
  text-align: center;
  margin: 3rem 0 2rem;
  color: var(--primary-foreground-color);
  opacity: 0.3;
  font-size: 0.6rem;
  letter-spacing: 0.5em;
}

/* ===== FEATURED SLIDER MEMBERS BADGE ===== */
.m-featured-article__members-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 3px;
  margin-left: 8px;
}

/* ===== MEMBERSHIP GATE STYLING ===== */
.gh-post-upgrade-cta {
  position: relative !important;
  border-radius: 8px !important;
  border-color: var(--brand-accent) !important;
}

.gh-post-upgrade-cta::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: -20px;
  right: -20px;
  height: 180px;
  background: linear-gradient(to bottom, transparent, var(--background-color, #fff));
  pointer-events: none;
  z-index: 1;
}

[data-theme="dark"] .gh-post-upgrade-cta::before {
  background: linear-gradient(to bottom, transparent, var(--background-color, #0c0e24));
}

.gh-post-upgrade-cta h2 {
  font-family: var(--font-heading) !important;
}

.gh-post-upgrade-cta .gh-btn {
  background: var(--brand-accent) !important;
  color: #fff !important;
  border-radius: 4px !important;
}

.gh-post-upgrade-cta .gh-btn:hover {
  background: #4da3cb !important;
}

/* ===== BUTTON OVERRIDES ===== */
.m-button.filled {
  background-color: var(--brand-accent);
  color: #fff;
  border-color: var(--brand-accent);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.m-button.filled:hover {
  background-color: #4da3cb;
  border-color: #4da3cb;
}

/* ===== DARK MODE REFINEMENTS FOR READING ===== */
[data-theme="dark"] .m-story-content .js-post-content p {
  color: #d4d4d8;
  line-height: 1.9;
}

[data-theme="dark"] .m-story-card {
  background: #1a1d3a;
  border: 1px solid #252840;
}

[data-theme="dark"] .m-article-card {
  background: #1a1d3a;
}

[data-theme="dark"] .m-blog-teaser-section {
  border-top-color: #252840;
}

[data-theme="dark"] .m-hero.with-picture {
  background-color: #0c0e24;
}

/* ===== GHOST COMMENTS ===== */
.m-comments {
  color: var(--primary-foreground-color);
}

.m-comments .ghost-comments,
.m-comments iframe {
  max-width: 100%;
}

.m-comments .ghost-comments {
  color-scheme: light;
}

[data-theme="dark"] .m-comments .ghost-comments {
  color-scheme: dark;
}

/* ===== POST SHARE / READING PROGRESS ===== */
.m-post-share-anchor {
  position: relative;
  max-width: 820px;
  height: 0;
  margin: 0 auto;
  z-index: 3;
}

.m-post-share-anchor.in-story {
  max-width: 720px;
}

@media only screen and (min-width: 64rem) {
  .m-post-share-anchor {
    position: absolute;
    top: 0;
    left: 50%;
    width: 100%;
    height: 100%;
    margin: 0;
    transform: translateX(-50%);
    pointer-events: none;
  }

  .m-post-share-anchor .m-share {
    height: 100%;
    pointer-events: auto;
  }
}

.m-icon-button.in-share .m-share__icon {
  display: block;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.m-share__reading-time {
  display: none;
}

@media only screen and (max-width: 63.9375rem) {
  .m-share {
    position: fixed;
    right: 1rem;
    bottom: max(1rem, env(safe-area-inset-bottom));
    left: auto;
    width: auto;
    height: auto;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
    z-index: 90;
  }

  .m-share__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: auto;
    pointer-events: none;
  }

  .m-share .m-icon-button.in-share {
    width: 46px;
    height: 46px;
    margin: 0;
    color: var(--titles-color);
    font-size: 0.95rem;
    background: var(--background-color);
    border: 1px solid rgba(20, 24, 54, 0.08);
    box-shadow: 0 8px 24px rgba(20, 24, 54, 0.16);
    pointer-events: auto;
  }

  .m-share .m-icon-button.in-share:hover,
  .m-share .m-icon-button.in-share:focus {
    color: var(--link-color);
    box-shadow: 0 10px 28px rgba(20, 24, 54, 0.22);
  }

  [data-theme="dark"] .m-share .m-icon-button.in-share {
    color: #f2f3fb;
    background: #171a2e;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  }

  body.share-menu-displayed .m-sticky-banner {
    display: none;
  }
}

@media only screen and (min-width: 64rem) {
  .m-share__reading-time {
    display: block;
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--meta-text-color, #6b6b6b);
    text-align: center;
    margin-top: 0.5rem;
    white-space: nowrap;
    letter-spacing: 0.02em;
    line-height: 1.3;
  }
}

/* ===== CONTINUE READING PROMPT ===== */
.m-continue-reading {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  background: var(--secondary-foreground-color);
  color: var(--background-color, #fff);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 100px;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 100;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.m-continue-reading.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.m-continue-reading:hover {
  background: var(--brand-accent);
  color: #fff;
}

/* ===== SUBSCRIBE POPUP ===== */
.m-subscribe-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 200;
  transition: background 0.3s ease;
}

.m-subscribe-popup-overlay.is-visible {
  background: rgba(0, 0, 0, 0.45);
}

.m-subscribe-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  opacity: 0;
  z-index: 201;
  background: var(--background-color, #fff);
  border-radius: 12px;
  padding: 2.5rem 2.5rem 2rem;
  text-align: center;
  max-width: 400px;
  width: calc(100% - 2rem);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.m-subscribe-popup.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.m-subscribe-popup__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--meta-text-color, #6b6b6b);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s ease;
}

.m-subscribe-popup__close:hover {
  color: var(--secondary-foreground-color);
}

.m-subscribe-popup__title {
  font-family: var(--font-body) !important;
  font-size: 1.5rem;
  font-weight: 400;
  font-style: italic;
  margin: 0 0 0.6rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--secondary-foreground-color);
}

.m-subscribe-popup__desc {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--meta-text-color, #6b6b6b);
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.m-subscribe-popup__btn {
  display: inline-block;
  padding: 0.65rem 2.2rem;
  font-size: 0.85rem;
  text-decoration: none;
}

[data-theme="dark"] .m-subscribe-popup {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ===== C2: MEMBER BENEFITS SHOWCASE ===== */
.m-subscribe-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.m-subscribe-benefits__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--secondary-foreground-color);
}

.m-subscribe-benefits__icon {
  font-size: 1.1rem;
  color: var(--brand-accent);
  flex-shrink: 0;
  width: 1.5rem;
  text-align: center;
}

/* ===== C4: STICKY SUBSCRIBE BANNER ===== */
.m-sticky-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--secondary-foreground-color);
  color: var(--background-color, #fff);
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  z-index: 99;
  transform: translateY(100%);
  transition: transform 0.4s ease;
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15);
}

.m-sticky-banner.is-visible {
  transform: translateY(0);
}

.m-sticky-banner__text {
  font-size: 0.85rem;
  font-weight: 500;
}

.m-sticky-banner__btn {
  background: var(--brand-accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.45rem 1.2rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.m-sticky-banner__btn:hover {
  background: #4da3cb;
}

.m-sticky-banner__close {
  background: none;
  border: none;
  color: var(--background-color, #fff);
  opacity: 0.6;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 0.25rem;
  line-height: 1;
  transition: opacity 0.2s ease;
}

.m-sticky-banner__close:hover {
  opacity: 1;
}

@media (max-width: 767px) {
  .m-sticky-banner {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
  }

  .m-sticky-banner__text {
    font-size: 0.75rem;
    flex: 1;
  }
}

/* ===== G1: MICRO-INTERACTIONS ===== */
.m-button,
.m-nav-btn,
.m-icon-button {
  transition: all 0.2s ease;
}

.m-button:active,
.m-nav-btn:active,
.m-post-cta__button:active {
  transform: scale(0.96);
}

.m-article-card {
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.m-article-card:hover {
  transform: translateY(-3px);
}

.m-featured-article__content {
  transition: opacity 0.3s ease;
}

.m-featured-article:hover .m-featured-article__content {
  opacity: 0.9;
}

/* ===== G2: STORY CARD REDESIGN (book-page aesthetic) ===== */
.m-story-card {
  background: var(--story-card-bg, #faf8f5);
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  position: relative;
}

.m-story-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--brand-accent), transparent);
  border-radius: 0 8px 8px 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.m-story-card:hover::after {
  opacity: 1;
}

.m-story-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
  transform: translateY(-3px);
}

.m-story-card__content {
  padding: 1.75rem 2rem 1.75rem 1.75rem;
}

.m-story-card__title {
  font-family: var(--font-heading) !important;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.m-story-card__excerpt {
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--meta-text-color, #6b6b6b);
  font-weight: 400;
}

.m-story-card.no-picture {
  border-left: 3px solid var(--brand-accent);
}

.m-story-card.no-picture::after {
  display: none;
}

[data-theme="dark"] .m-story-card {
  --story-card-bg: #181b35;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.15);
}

[data-theme="dark"] .m-story-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.2);
}

/* ===== G4: SKELETON LOADING STATES ===== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.m-skeleton {
  background: linear-gradient(90deg,
    var(--skeleton-base, #eee) 25%,
    var(--skeleton-shine, #f5f5f5) 50%,
    var(--skeleton-base, #eee) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.m-story-card__picture img[loading="lazy"]:not([src]),
.m-article-card__picture-background[loading="lazy"]:not([src]) {
  background: linear-gradient(90deg,
    var(--skeleton-base, #eee) 25%,
    var(--skeleton-shine, #f5f5f5) 50%,
    var(--skeleton-base, #eee) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

[data-theme="dark"] .m-skeleton,
[data-theme="dark"] .m-story-card__picture img[loading="lazy"]:not([src]),
[data-theme="dark"] .m-article-card__picture-background[loading="lazy"]:not([src]) {
  --skeleton-base: #1e2145;
  --skeleton-shine: #252850;
}

/* ===== D2: SEARCH OVERLAY ENHANCEMENTS ===== */
.m-search .m-input.in-search {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 500;
}

.m-search__shortcut-hint {
  display: none;
}

@media only screen and (min-width: 48rem) {
  .m-search__shortcut-hint {
    display: block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--meta-text-color, #6b6b6b);
    text-align: center;
    margin-top: 1rem;
  }

  .m-search__shortcut-hint kbd {
    display: inline-block;
    background: var(--primary-border-color);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 600;
  }
}

/* ===== G3: CUSTOM 404 PAGE ===== */
.m-404-content {
  max-width: 480px;
}

.m-404-search {
  margin-bottom: 1.5rem;
}

.m-404-search .m-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.m-404-stories {
  text-align: left;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--primary-border-color);
  border-radius: 8px;
}

.m-404-stories__heading {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--meta-text-color, #6b6b6b);
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.m-404-stories__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.m-404-stories__list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--primary-border-color);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.m-404-stories__list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.m-404-stories__link {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--secondary-foreground-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.m-404-stories__link:hover {
  color: var(--brand-accent);
}

.m-404-stories__meta {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--meta-text-color, #6b6b6b);
  white-space: nowrap;
}

[data-theme="dark"] .m-404-stories {
  border-color: #252840;
}

[data-theme="dark"] .m-404-stories__list li {
  border-bottom-color: #252840;
}

/* ===== COMPACT FOOTER ===== */
.m-footer__content {
  padding: 25px 20px;
}

@media only screen and (min-width: 48rem) {
  .m-footer__content {
    padding: 30px 0;
  }
}

.m-footer-social {
  margin-bottom: 10px;
}

.m-site-recommendations {
  margin: 0 auto 20px;
  max-width: 560px;
}

.m-site-recommendations .recommendations {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.m-site-recommendations .recommendation a {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  color: #fff;
  display: grid;
  gap: 4px 10px;
  grid-template-columns: 28px 1fr;
  padding: 10px 12px;
  text-align: left;
}

.m-site-recommendations .recommendation-favicon {
  grid-row: 1 / span 2;
  height: 28px;
  width: 28px;
}

.m-site-recommendations .recommendation-favicon img {
  border-radius: 4px;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.m-site-recommendations .recommendation-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  text-transform: none;
}

.m-site-recommendations .recommendation-url {
  font-size: 0.75rem;
  line-height: 1.2;
  opacity: 0.75;
}

.m-site-recommendations .recommendation-description {
  display: none;
}

.m-footer-copyright {
  margin-bottom: 0;
}

/* ===== NAV "BOOKS" DROPDOWN LABEL ===== */
.m-nav__left .more > span > a {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ===== HIDE TAGS ON SHORT STORIES ===== */
.tag-short-story .m-tags.in-post {
  display: none !important;
}

/* ===== ARTICLE CARD REFINEMENTS ===== */
.m-article-card__title {
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.m-featured-article__title {
  text-transform: uppercase !important;
  letter-spacing: 0.02em !important;
}

.m-article-card.tag-short-story .m-article-card__title {
  text-transform: uppercase !important;
  letter-spacing: 0.02em !important;
}

/* ===== AUTHOR SECTION ON POST ===== */
.m-author__name a {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ===== TAG PAGE REFINEMENTS ===== */
.m-tags.in-post ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.m-tags.in-post ul li a {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: lowercase;
}

/* ===== HERO DESCRIPTION ===== */
.m-hero-description {
  font-family: var(--font-body);
  font-weight: 400;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .l-post-content .js-post-content p,
  .l-post-content .js-post-content li {
    font-size: 1.12rem;
    line-height: 1.82;
  }

  .m-story-card {
    flex-direction: row;
  }

  .m-story-card__picture {
    width: 40%;
    min-width: 40%;
    aspect-ratio: auto;
  }

  .m-story-card__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .m-story-title {
    font-size: 3rem;
  }
}

@media (max-width: 767px) {
  .m-story-title {
    font-size: 2rem;
  }

  .m-blog-teaser-header {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 767px) {
  .m-hero.with-picture.in-story {
    background: var(--background-color, #fff) !important;
    min-height: auto;
    padding: 0;
    overflow: visible;
  }

  .m-hero__picture.in-post.in-story {
    position: relative;
    width: 100%;
    height: auto;
    padding-top: 56px; /* clear fixed navbar */
    opacity: 1;
  }

  .m-hero__picture.in-post.in-story picture {
    height: auto;
    width: 100%;
  }

  .m-hero__picture.in-post.in-story img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    max-height: none;
  }
}

/* ===== FULL FEATURE IMAGE ON POSTS (no crop) ===== */
.m-hero.with-picture.in-post-hero {
  background: var(--background-color, #fff) !important;
}

@media (min-width: 768px) {
  .m-hero.with-picture.in-post-hero {
    min-height: auto;
    padding: 0;
    overflow: visible;
  }

  .m-hero__picture.in-post.in-post-hero {
    position: relative;
    width: 100%;
    height: auto;
    padding-top: 56px; /* clear fixed navbar */
  }

  .m-hero__picture.in-post.in-post-hero picture {
    height: auto;
    width: 100%;
  }

  .m-hero__picture.in-post.in-post-hero img {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 70vh;
  }
}

/* ===== CREATIVE ATMOSPHERE SYSTEM ===== */
body.story-atmosphere-enabled {
  background-image:
    linear-gradient(90deg, rgba(20, 24, 54, 0.018) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 24, 54, 0.012) 1px, transparent 1px);
  background-size: 42px 42px, 42px 42px;
}

[data-theme="dark"] body.story-atmosphere-enabled {
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
}

body.story-atmosphere-enabled .cm-reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity var(--motion-slow) var(--ease-editorial),
    transform var(--motion-slow) var(--ease-editorial);
  transition-delay: var(--cm-reveal-delay, 0ms);
  will-change: opacity, transform;
}

body.story-atmosphere-enabled .cm-reveal.is-visible,
body.story-atmosphere-reduced .cm-reveal {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

/* Homepage: atmospheric editorial arrival */
body.story-atmosphere-enabled.home-template .m-hero.with-picture {
  isolation: isolate;
  min-height: 520px;
  background: #080a17;
}

body.story-atmosphere-enabled.home-template .m-hero__picture {
  opacity: 0.82;
}

body.story-atmosphere-enabled.home-template .m-hero__picture::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 10, 23, 0.18), rgba(8, 10, 23, 0.58)),
    linear-gradient(90deg, rgba(8, 10, 23, 0.45), transparent 38%, rgba(8, 10, 23, 0.35));
  pointer-events: none;
}

body.story-atmosphere-enabled.home-template .m-hero__picture img {
  filter: saturate(0.9) contrast(1.08);
  transform: scale(1.035);
}

body.story-atmosphere-enabled.home-template .m-hero__content {
  max-width: 760px;
}

body.story-atmosphere-enabled.home-template .m-hero-title.bigger {
  font-size: 2.25rem;
  letter-spacing: 0.055em;
  text-shadow: 0 12px 38px rgba(0, 0, 0, 0.32);
}

body.story-atmosphere-enabled.home-template .m-hero-description.bigger {
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.65;
}

body.story-atmosphere-enabled.home-template .m-hero__content .m-button {
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(95, 182, 222, 0.22);
}

/* Homepage featured story: cinematic showcase */
body.story-atmosphere-enabled .m-featured-slider.swiper {
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 22px 70px rgba(20, 24, 54, 0.16), 0 0 0 1px rgba(95, 182, 222, 0.04);
}

body.story-atmosphere-enabled .m-featured-article::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.62)),
    linear-gradient(90deg, rgba(8, 10, 23, 0.54), rgba(8, 10, 23, 0.04) 54%);
  pointer-events: none;
  z-index: 2;
}

body.story-atmosphere-enabled .m-featured-article__picture-background {
  opacity: 0.86;
  filter: saturate(0.95) contrast(1.08);
  transform: scale(1.01);
  transition: transform 900ms var(--ease-editorial), filter 900ms var(--ease-editorial);
}

body.story-atmosphere-enabled .m-featured-article:hover .m-featured-article__picture-background {
  filter: saturate(1.04) contrast(1.12);
  transform: scale(1.045);
}

body.story-atmosphere-enabled .m-featured-article__content {
  z-index: 4;
}

body.story-atmosphere-enabled .m-featured-article__title {
  letter-spacing: 0.04em !important;
  max-width: 86%;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.44);
}

body.story-atmosphere-enabled .m-featured-article__timestamp,
body.story-atmosphere-enabled .m-featured-article__ribbon,
body.story-atmosphere-enabled .m-featured-article__meta {
  z-index: 5;
}

body.story-atmosphere-enabled .m-icon-button.in-featured-articles {
  background: rgba(255, 255, 255, 0.94);
  color: #141836;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

/* Story cards: tactile, readable, story-first */
body.story-atmosphere-enabled .m-stories-section-header {
  border-bottom: 0;
  margin-top: 3.25rem;
  position: relative;
}

body.story-atmosphere-enabled .m-stories-section-header::after {
  content: "";
  display: block;
  width: 92px;
  height: 1px;
  margin: 1.35rem auto 0;
  background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
  opacity: 0.8;
}

body.story-atmosphere-enabled .m-story-card {
  border: 1px solid var(--story-line-light);
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, var(--story-card-bg, var(--story-paper-light)), var(--background-color));
  box-shadow: 0 14px 34px rgba(20, 24, 54, 0.075);
}

body.story-atmosphere-enabled .m-story-card__picture::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(8, 10, 23, 0.18));
  pointer-events: none;
}

body.story-atmosphere-enabled .m-story-card:hover,
body.story-atmosphere-enabled .m-story-card:focus-within {
  box-shadow: 0 20px 48px rgba(20, 24, 54, 0.12);
  transform: translateY(-5px);
}

body.story-atmosphere-enabled .m-story-card__featured-badge,
body.story-atmosphere-enabled .m-story-card__members-badge {
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  background: rgba(95, 182, 222, 0.1);
}

body.story-atmosphere-enabled .m-story-card__excerpt {
  color: color-mix(in srgb, var(--primary-foreground-color) 82%, var(--meta-text-color));
  transition: color var(--motion-soft) ease, transform var(--motion-soft) var(--ease-editorial);
}

body.story-atmosphere-enabled .m-story-card:hover .m-story-card__excerpt,
body.story-atmosphere-enabled .m-story-card:focus-within .m-story-card__excerpt {
  color: var(--primary-foreground-color);
  transform: translateX(2px);
}

[data-theme="dark"] body.story-atmosphere-enabled .m-story-card {
  border-color: var(--story-line-dark);
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, var(--story-card-bg, var(--story-paper-dark)), #111422);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

[data-theme="dark"] body.story-atmosphere-enabled .m-story-card:hover,
[data-theme="dark"] body.story-atmosphere-enabled .m-story-card:focus-within {
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.34);
}

/* Story pages: title-card entrance and quieter body rhythm */
body.story-atmosphere-enabled.tag-short-story .m-story-heading {
  position: relative;
  margin-bottom: 2.4rem;
  padding-bottom: 1.4rem;
}

body.story-atmosphere-enabled.tag-short-story .m-story-heading::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 72px;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
}

body.story-atmosphere-enabled.tag-short-story .m-story-title {
  letter-spacing: 0.045em;
}

body.story-atmosphere-enabled.tag-short-story .m-story-content .js-post-content {
  text-rendering: optimizeLegibility;
}

body.story-atmosphere-enabled.tag-short-story .m-story-content .js-post-content p:first-of-type {
  margin-top: 0.35rem;
}

body.story-atmosphere-enabled.tag-short-story .m-story-content .js-post-content hr {
  width: 96px;
  height: 1px;
  margin: 3rem auto;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
  opacity: 0.75;
}

body.story-atmosphere-enabled .m-story-end {
  margin: 4rem 0 2.5rem;
  opacity: 1;
}

body.story-atmosphere-enabled .m-story-end__marker {
  color: var(--brand-accent);
  filter: drop-shadow(0 6px 18px rgba(95, 182, 222, 0.18));
  opacity: 0.72;
}

/* More Stories and post-end modules */
body.story-atmosphere-enabled .m-author,
body.story-atmosphere-enabled .m-comments,
body.story-atmosphere-enabled .m-recommended {
  border-top: 1px solid var(--primary-border-color);
}

body.story-atmosphere-enabled .m-author {
  background:
    linear-gradient(180deg, rgba(95, 182, 222, 0.045), transparent 45%),
    var(--background-color);
}

body.story-atmosphere-enabled .m-recommended {
  margin-top: 1rem;
}

body.story-atmosphere-enabled .m-section-title.in-recommended {
  color: var(--secondary-foreground-color);
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  margin-bottom: 0 !important;
}

body.story-atmosphere-enabled .m-recommended-slider .swiper-wrapper {
  padding-top: 34px;
}

body.story-atmosphere-enabled .m-recommended-slider .m-article-card {
  border-color: var(--story-line-light);
}

body.story-atmosphere-enabled.tag-short-story .m-recommended-slider .m-article-card__title {
  text-transform: uppercase !important;
  letter-spacing: 0.035em !important;
}

[data-theme="dark"] body.story-atmosphere-enabled .m-recommended-slider .m-article-card {
  border-color: var(--story-line-dark);
}

/* Navigation, search, comments, and member surfaces */
body.story-atmosphere-enabled .m-menu.opened,
body.story-atmosphere-enabled .m-search.opened {
  background-image:
    linear-gradient(180deg, rgba(95, 182, 222, 0.08), transparent 34%),
    linear-gradient(90deg, rgba(20, 24, 54, 0.035) 1px, transparent 1px);
  background-size: auto, 38px 38px;
}

[data-theme="dark"] body.story-atmosphere-enabled .m-menu.opened,
[data-theme="dark"] body.story-atmosphere-enabled .m-search.opened {
  background-image:
    linear-gradient(180deg, rgba(95, 182, 222, 0.08), transparent 34%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
}

body.story-atmosphere-enabled .m-recent-article {
  transition: transform var(--motion-soft) var(--ease-editorial);
}

body.story-atmosphere-enabled .m-recent-article:hover,
body.story-atmosphere-enabled .m-recent-article:focus-within {
  transform: translateY(-3px);
}

body.story-atmosphere-enabled .m-comments {
  padding-bottom: 1rem;
}

body.story-atmosphere-enabled .gh-post-upgrade-cta {
  background:
    linear-gradient(135deg, rgba(95, 182, 222, 0.1), transparent 38%),
    var(--background-color) !important;
  box-shadow: 0 18px 50px rgba(20, 24, 54, 0.1) !important;
}

[data-theme="dark"] body.story-atmosphere-enabled .gh-post-upgrade-cta {
  box-shadow: 0 18px 58px rgba(0, 0, 0, 0.28) !important;
}

@media only screen and (min-width: 48rem) {
  body.story-atmosphere-enabled.home-template .m-hero-title.bigger {
    font-size: 3.4rem;
  }
}

@media only screen and (min-width: 64rem) {
  body.story-atmosphere-enabled .m-story-card__picture img,
  body.story-atmosphere-enabled .m-article-card__picture-background,
  body.story-atmosphere-enabled .m-recent-article__picture img {
    transition: transform 700ms var(--ease-editorial), filter 700ms var(--ease-editorial);
  }
}

@media only screen and (max-width: 63.9375rem) {
  body.share-menu-displayed {
    padding-bottom: 0 !important;
  }

  body.story-atmosphere-enabled .m-share .m-icon-button.in-share {
    backdrop-filter: blur(10px);
  }

  body.story-atmosphere-enabled .m-recommended-articles {
    margin-left: -20px;
    margin-right: -20px;
  }
}

@media only screen and (max-width: 47.9375rem) {
  body.story-atmosphere-enabled.home-template .m-hero.with-picture {
    min-height: 430px;
  }

  body.story-atmosphere-enabled.home-template .m-hero-title.bigger {
    font-size: 2rem;
  }

  body.story-atmosphere-enabled .m-story-content .js-post-content p {
    font-size: 1.03rem;
    line-height: 1.9;
    margin-bottom: 1.55em;
  }

  body.story-atmosphere-enabled .l-post-content .js-post-content p,
  body.story-atmosphere-enabled .l-post-content .js-post-content li {
    line-height: 1.72;
  }

  body.story-atmosphere-enabled.tag-short-story .m-story-content .js-post-content p,
  body.story-atmosphere-enabled.tag-short-story .m-story-content .js-post-content li {
    line-height: 1.9;
  }
}

@media (prefers-reduced-motion: no-preference) {
  body.story-atmosphere-enabled.home-template .m-hero__picture img {
    animation: cmHeroDrift 24s var(--ease-editorial) infinite alternate;
  }
}

@keyframes cmHeroDrift {
  from {
    transform: scale(1.035);
  }
  to {
    transform: scale(1.075) translate3d(-0.6%, -0.4%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.story-atmosphere-enabled *,
  body.story-atmosphere-enabled *::before,
  body.story-atmosphere-enabled *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  body.story-atmosphere-enabled .cm-reveal {
    opacity: 1;
    transform: none;
  }
}
