/* ==========================================================================
   GladeX Journal: the post list, posts and their reading typography.
   Built on the tokens in style.css.
   ========================================================================== */

/* ---------- List ---------- */
.j-hero { padding-top: clamp(140px, 18vw, 220px); padding-bottom: clamp(40px, 6vw, 64px); }
.j-hero .lead { max-width: 46ch; }

.j-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.j-chip {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-secondary);
  transition: color .3s var(--ease-soft), border-color .3s var(--ease-soft), background .3s var(--ease-soft);
}
.j-chip:hover { color: var(--text); border-color: var(--text); }
.j-chip.is-active { background: var(--text); color: #000; border-color: var(--text); }

.j-list { padding-bottom: var(--section-pad); }
.j-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 980px) { .j-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .j-grid { grid-template-columns: 1fr; } }

.j-card {
  display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-alt); overflow: hidden; transition: border-color .4s var(--ease-soft), transform .6s var(--ease), background .4s var(--ease-soft);
}
.j-card:hover { border-color: var(--border-strong); transform: translateY(-4px); background: var(--bg-alt-2); }
.j-card__cover { aspect-ratio: 16 / 9; background: radial-gradient(120% 120% at 30% 20%, #141414, #070707); overflow: hidden; display: grid; place-items: center; }
.j-card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease); }
.j-card:hover .j-card__cover img { transform: scale(1.035); }
.j-card__mark img { width: 40px !important; height: 40px !important; opacity: .45; object-fit: contain; }
.j-card__body { padding: 24px 24px 26px; display: flex; flex-direction: column; flex: 1; }
.j-card__title { font-size: 22px; line-height: 1.22; margin-top: 12px; letter-spacing: -0.015em; }
.j-card__excerpt { color: var(--text-secondary); font-size: 15px; line-height: 1.55; margin-top: 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.j-card__date { margin-top: auto; padding-top: 18px; font-size: 13px; color: var(--text-tertiary); }

/* The big first story */
.j-feature { margin-bottom: 24px; }
.j-card--feature { display: grid; grid-template-columns: 1.25fr 1fr; }
.j-card--feature .j-card__cover { aspect-ratio: auto; min-height: 380px; }
.j-card--feature .j-card__body { padding: clamp(28px, 4vw, 52px); justify-content: center; }
.j-card--feature .j-card__title { font-size: clamp(28px, 3.2vw, 42px); line-height: 1.08; letter-spacing: -0.025em; margin-top: 16px; }
.j-card--feature .j-card__excerpt { font-size: 17px; -webkit-line-clamp: 4; margin-top: 16px; }
.j-card--feature .j-card__date { margin-top: 28px; padding-top: 0; }
@media (max-width: 860px) {
  .j-card--feature { grid-template-columns: 1fr; }
  .j-card--feature .j-card__cover { aspect-ratio: 16 / 9; min-height: 0; }
}

.j-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); }
.j-meta a:hover { color: var(--text); }
.j-meta > * + *::before { content: '·'; margin-right: 12px; }

.j-empty { color: var(--text-tertiary); padding: 64px 0; font-size: 18px; }
.j-pager { display: flex; justify-content: space-between; align-items: center; margin-top: 56px; gap: 16px; }
.j-pager__n { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-tertiary); }

/* ---------- A post ---------- */
.j-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 150; pointer-events: none; }
.j-progress i { display: block; height: 100%; background: var(--text); transform-origin: 0 50%; transform: scaleX(0); }

.j-post { padding-top: clamp(130px, 16vw, 180px); padding-bottom: clamp(72px, 9vw, 120px); }
.j-post__head { max-width: calc(820px + var(--gutter) * 2); text-align: center; }
.j-crumbs { display: inline-flex; gap: 10px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-tertiary); }
.j-crumbs a:hover { color: var(--text); }
.j-post__title { font-size: clamp(38px, 5.6vw, 72px); letter-spacing: -0.035em; line-height: 1.03; margin-top: 22px; text-wrap: balance; }
.j-post__lead { margin: 24px auto 0; max-width: 40em; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.55; color: var(--text-secondary); text-wrap: pretty; }
.j-post__meta { justify-content: center; margin-top: 28px; }
.j-post__cover { max-width: calc(1120px + var(--gutter) * 2); margin-top: clamp(40px, 6vw, 64px); }
.j-post__cover img { width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--border); }

.j-post__wrap { max-width: calc(720px + var(--gutter) * 2); margin-top: clamp(40px, 6vw, 64px); }
.j-post.has-toc .j-post__wrap { max-width: calc(1120px + var(--gutter) * 2); display: grid; grid-template-columns: 220px minmax(0, 720px); gap: 64px; justify-content: center; }
.j-post__side { position: relative; }
.j-post__side .j-toc { position: sticky; top: 110px; }
.j-toc__title { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 14px; }
.j-toc ol { list-style: none; border-left: 1px solid var(--border); }
.j-toc li a { display: block; padding: 6px 0 6px 16px; margin-left: -1px; border-left: 1px solid transparent; font-size: 14px; line-height: 1.4; color: var(--text-tertiary); transition: color .25s, border-color .25s; }
.j-toc li a:hover { color: var(--text); }
.j-toc li a.is-active { color: var(--text); border-left-color: var(--text); }
.j-toc-mobile { display: none; }
@media (max-width: 1040px) {
  .j-post.has-toc .j-post__wrap { display: block; max-width: calc(720px + var(--gutter) * 2); }
  .j-post__side { display: none; }
  .j-toc-mobile { display: block; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px 18px; margin-bottom: 36px; background: var(--bg-alt); }
  .j-toc-mobile summary { cursor: pointer; list-style: none; padding: 12px 0; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); }
  .j-toc-mobile summary::after { content: '+'; float: right; }
  .j-toc-mobile[open] summary::after { content: '–'; }
  .j-toc-mobile .j-toc { padding-bottom: 12px; } .j-toc-mobile .j-toc__title { display: none; }
}

/* Reading typography */
.j-prose { font-size: 18.5px; line-height: 1.78; color: #d4d4d4; overflow-wrap: break-word; }
.j-prose > * + * { margin-top: 1.15em; }
.j-prose h2 { font-size: clamp(26px, 2.6vw, 32px); color: var(--text); margin-top: 2.1em; line-height: 1.15; letter-spacing: -0.02em; scroll-margin-top: 100px; }
.j-prose h3 { font-size: 22px; color: var(--text); margin-top: 1.8em; line-height: 1.25; scroll-margin-top: 100px; }
.j-prose h4 { font-size: 18.5px; color: var(--text); margin-top: 1.6em; }
.j-prose h2 + *, .j-prose h3 + *, .j-prose h4 + * { margin-top: .6em; }
.j-prose strong, .j-prose b { color: var(--text); font-weight: 600; }
.j-prose mark { background: rgba(255,255,255,.14); color: var(--text); padding: 0 .2em; border-radius: 3px; }
.j-prose a:not(.btn):not(.appstore-badge-link):not(.j-app__info):not(.j-video__poster) { color: var(--text); text-decoration: underline; text-decoration-color: rgba(255,255,255,.3); text-underline-offset: 3px; transition: text-decoration-color .3s; }
.j-prose a:not(.btn):hover { text-decoration-color: var(--text); }
.j-prose ul, .j-prose ol { padding-left: 1.35em; }
.j-prose ul { list-style: disc; }
.j-prose ol { list-style: decimal; }
.j-prose li + li { margin-top: .5em; }
.j-prose li::marker { color: var(--text-tertiary); }
.j-prose blockquote { border-left: 2px solid var(--text); padding: 2px 0 2px 26px; color: var(--text); font-size: 1.2em; line-height: 1.55; letter-spacing: -0.01em; }
.j-prose hr { border: 0; height: 1px; background: var(--border); margin: 2.6em 0; }
.j-prose figure img { border-radius: var(--radius-md); border: 1px solid var(--border); margin-inline: auto; height: auto; }
.j-prose figure figcaption { font-size: 14px; color: var(--text-tertiary); text-align: center; margin-top: 12px; line-height: 1.5; }
.j-prose figure[data-size="wide"] { margin-inline: clamp(-120px, -8vw, 0px); }
.j-prose figure[data-size="full"] { width: 100vw; margin-left: 50%; transform: translateX(-50%); max-width: none; }
.j-post.has-toc .j-prose figure[data-size="full"] { width: auto; margin-left: 0; transform: none; }
.j-prose figure[data-size="full"] img { border-radius: 0; border-left: 0; border-right: 0; width: 100%; }
.j-prose code { font-family: var(--font-mono); font-size: .86em; background: var(--bg-alt-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.j-prose pre { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px 20px; overflow-x: auto; font-size: 15px; line-height: 1.6; }
.j-prose pre code { border: 0; padding: 0; background: none; }

.j-callout { display: block; border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 20px 22px; background: var(--bg-alt); font-size: .95em; }
.j-callout > * + * { margin-top: .7em; }
.j-callout__label { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 8px; }
.j-callout--tip { border-color: rgba(134, 239, 172, .35); } .j-callout--tip .j-callout__label { color: #86efac; }
.j-callout--warn { border-color: rgba(253, 186, 116, .4); } .j-callout--warn .j-callout__label { color: #fdba74; }

.j-btn-row { display: flex; }
.j-btn-row .btn { text-decoration: none; }

.j-video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); background: radial-gradient(120% 140% at 50% 0%, #1a1a1a, #050505); }
.j-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.j-video__poster { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--text); text-decoration: none; }
.j-video__play { width: 74px; height: 74px; border-radius: 50%; background: var(--text); position: relative; transition: transform .4s var(--ease); }
.j-video__play::after { content: ''; position: absolute; left: 30px; top: 23px; border-left: 20px solid #000; border-top: 14px solid transparent; border-bottom: 14px solid transparent; }
.j-video__poster:hover .j-video__play { transform: scale(1.06); }
.j-video__label { font-weight: 600; }
.j-video__note { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-tertiary); }

/* The app card: inside a post or at its end */
.j-app { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 22px 24px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: linear-gradient(180deg, #0c0c0c, #060606); }
.j-prose .j-app { margin-block: 2em; font-size: 16px; line-height: 1.5; }
.j-app__info { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1 1 260px; }
.j-app__icon { width: 64px; height: 64px; border-radius: 15px; flex: none; }
.j-app__name { display: block; color: var(--text); font-weight: 600; font-size: 18px; line-height: 1.2; }
.j-app__tag { display: block; color: var(--text-secondary); font-size: 14px; line-height: 1.45; margin-top: 4px; }
.j-post__app { margin-top: 56px; }

.j-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border); }
.j-share__label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-tertiary); margin-right: 6px; }
.j-share__btn { font-size: 13.5px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-secondary); transition: color .25s, border-color .25s; }
.j-share__btn:hover { color: var(--text); border-color: var(--text); }

.j-more { padding-bottom: clamp(80px, 10vw, 140px); border-top: 1px solid var(--border); padding-top: clamp(64px, 8vw, 110px); }
.j-more__head { align-items: center; }
.j-preview { position: fixed; z-index: 200; left: 50%; bottom: 18px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 12px;
  letter-spacing: .1em; text-transform: uppercase; background: var(--text); color: #000; padding: 8px 14px; border-radius: 999px; }

@media (max-width: 640px) {
  .j-prose { font-size: 17.5px; }
  .j-post__head { text-align: left; } .j-post__meta { justify-content: flex-start; } .j-post__lead { margin-left: 0; }
  .j-prose figure[data-size="wide"] { margin-inline: 0; }
}
@media print { .nav, .footer, .j-share, .j-more, .j-progress, .j-post__side, .j-toc-mobile { display: none !important; } }
.j-list { transition: opacity .25s var(--ease-soft); }
.j-list.is-loading { opacity: .35; pointer-events: none; }
@media (max-width: 640px) {
  .j-filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .j-filters::-webkit-scrollbar { display: none; }
  .j-chip { flex: none; }
}
