/* ==========================================================
   Blog / magazine (public). v0.7 refresh.
   Loaded via $meta['styles'] together with games.css.
   ========================================================== */

[hidden] { display: none !important; }

/* ---- list ---- */
.blog-search {
  position: relative; z-index: 2; display: flex; gap: .4rem; align-items: center;
  max-width: 40rem; margin: 1.25rem 0 0; padding: .4rem;
  background: #fff; border: 2px solid var(--c-green-dd); border-radius: 999px; box-shadow: var(--shadow-hard);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.blog-search:focus-within { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--c-green); }
.blog-search input { flex: 1; min-width: 0; border: 0; box-shadow: none !important; background: transparent; min-height: 44px; border-radius: 999px; }
.blog-search .btn { flex-shrink: 0; min-height: 44px; }
.blog-cats {
  display: flex; gap: .45rem; margin: 0 0 1.75rem; padding: .25rem 0 .5rem;
  overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.blog-cats .chip { flex-shrink: 0; padding: .35rem 1.05rem; font-size: .9rem; background: #fff; border: 1.5px solid var(--c-border); }
.blog-cats .chip:hover { border-color: var(--c-green-dd); }
.blog-cats .chip[aria-current="page"] { background: var(--c-green-dd); color: #fff; border-color: var(--c-green-dd); }
.blog-page-body { padding-top: 2rem; }

.post-grid { display: grid; grid-template-columns: 1fr; gap: 1.35rem; }
.post-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 22px; box-shadow: var(--shadow);
  transition: transform .35s var(--spring), box-shadow .35s var(--ease), border-color .2s ease;
}
.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lift); border-color: var(--c-border-strong); }
.post-card-media { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--c-green-wash); overflow: hidden; }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.post-card:hover .post-card-media img { transform: scale(1.06); }
.post-card-placeholder {
  display: grid; place-items: center; height: 100%; font-size: 2.8rem;
  background-color: #fff4d6; background-image: repeating-linear-gradient(to bottom, transparent 0 21px, rgba(59, 134, 207, .14) 21px 22px);
}
.post-card-body { padding: 1rem 1.15rem 1.15rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.post-card-body > .chip { position: relative; z-index: 1; align-self: flex-start; }
.post-card-title { margin: 0; font-size: 1.12rem; line-height: 1.6; }
.post-card-title a { color: inherit; text-decoration: none; }
.post-card-title a::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.post-card-title a:focus-visible { outline: 0; }
.post-card:has(.post-card-title a:focus-visible) { outline: 3px solid var(--c-green-d); outline-offset: 3px; }
.post-card:hover .post-card-title a { color: var(--c-green-dd); }
.post-card-excerpt {
  margin: 0; color: var(--c-muted); font-size: .93rem; line-height: 1.85;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; padding-top: .75rem; border-top: 1px dashed var(--c-border); font-size: .85rem; color: var(--c-muted); font-weight: 600; }
.post-card-more { font-weight: 900; color: var(--c-green-d); transition: transform .25s var(--ease); }
.post-card:hover .post-card-more { transform: translateX(-4px); }

/* Featured first card on page 1 of the blog index */
.post-grid.has-lead > .post-card:first-child .post-card-title { font-size: clamp(1.2rem, 2.4vw, 1.6rem); }

/* ---- article ---- */
.read-progress { position: fixed; inset-inline: 0; top: 0; z-index: 70; height: 4px; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 100%; background: linear-gradient(to left, var(--c-green), var(--c-sun)); transform-origin: right center; transform: scaleX(0); }

.post-hero { padding-bottom: clamp(3rem, 7vw, 5rem); }
.post-header { max-width: 50rem; }
.post-header h1 { margin: .6rem 0 .75rem; font-size: clamp(1.9rem, 4.6vw, 2.9rem); line-height: 1.35; color: var(--c-green-dark); max-width: none; }
.post-header .lead { margin: 0 0 1rem; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; font-size: .9rem; }
.post-meta > span { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .8rem; border-radius: 999px; background: #fff; border: 1px solid var(--c-border); color: #46523d; font-weight: 700; }

.post-shell { display: grid; gap: 1.5rem; margin-top: calc(-1 * clamp(2rem, 5vw, 3.5rem)); position: relative; z-index: 2; }
.post-article {
  min-width: 0; background: #fff; border: 1px solid var(--c-border); border-radius: 26px; box-shadow: var(--shadow);
  padding: clamp(1.1rem, 4vw, 2.5rem);
}
.post-cover { margin: calc(-1 * clamp(1.1rem, 4vw, 2.5rem)) calc(-1 * clamp(1.1rem, 4vw, 2.5rem)) 1.75rem; }
.post-cover img { width: 100%; height: auto; display: block; border-radius: 26px 26px 0 0; }

.post-body { font-size: 1.08rem; line-height: 2.1; overflow-wrap: anywhere; color: #1f2a15; }
.post-body > :first-child { margin-top: 0; }
.post-body h2, .post-body h3, .post-body h4 { line-height: 1.55; margin: 2.2rem 0 .8rem; scroll-margin-top: calc(var(--header-h) + 1.25rem); }
.post-body h2 { font-size: 1.5rem; padding-bottom: .4rem; border-bottom: 2px dashed var(--c-border); }
.post-body h3 { font-size: 1.22rem; }
.post-body h4 { font-size: 1.06rem; }
.post-body p { margin: 0 0 1.2rem; }
.post-body ul, .post-body ol { margin: 0 0 1.2rem; padding-inline-start: 1.6rem; }
.post-body li { margin-block: .3rem; }
.post-body li::marker { color: var(--c-green); font-weight: 900; }
.post-body a { color: var(--c-green-d); font-weight: 700; text-decoration-color: var(--c-green-m); text-decoration-thickness: 2px; }
.post-body a:hover { color: var(--c-green-dd); background: var(--c-green-wash); }
.post-body b, .post-body strong { color: var(--c-text); font-weight: 800; }
.post-body code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--c-bg); padding: .1em .35em; border-radius: 6px; }

.post-quote { position: relative; margin: 1.75rem 0; padding: 1.1rem 1.5rem 1.1rem 1.25rem; border-inline-start: 5px solid var(--c-green); background: var(--c-green-wash); border-radius: 0 18px 18px 0; }
.post-quote::before { content: "❝"; position: absolute; inset-inline-end: 1rem; top: -.2rem; font-size: 3.2rem; line-height: 1; color: rgba(103, 165, 22, .35); }
.post-quote blockquote { margin: 0; font-size: 1.15rem; font-weight: 600; }
.post-quote blockquote p { margin: 0; }
.post-quote figcaption { margin-top: .5rem; color: var(--c-muted); font-size: .9rem; font-weight: 700; }
.post-quote figcaption::before { content: "— "; }

.post-figure { margin: 1.75rem 0; }
.post-figure img, .post-figure video { display: block; max-width: 100%; height: auto; margin-inline: auto; border-radius: 18px; }
.post-figure video { width: 100%; background: #000; }
.post-figure figcaption { text-align: center; color: var(--c-muted); font-size: .88rem; margin-top: .5rem; }

.post-table-wrap { margin: 1.75rem 0; overflow-x: auto; border: 1px solid var(--c-border); border-radius: 16px; }
.post-table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.post-table th, .post-table td { border-bottom: 1px solid var(--c-border); padding: .65rem .9rem; text-align: start; vertical-align: top; }
.post-table tr:last-child td { border-bottom: 0; }
.post-table thead th { background: var(--c-green-wash); color: var(--c-green-dd); }
.post-table tbody tr:nth-child(even) td { background: #fafbf7; }

.post-code { margin: 1.75rem 0; padding: 1.1rem 1.25rem; background: #17200f; color: #e6f0d8; border-radius: 16px; overflow-x: auto; line-height: 1.7; text-align: left; }
.post-code code { background: none; padding: 0; color: inherit; font-size: .9rem; white-space: pre; }
.post-delimiter { border: 0; text-align: center; margin: 2.25rem 0; }
.post-delimiter::before { content: "✦ ✦ ✦"; color: var(--c-green-m); letter-spacing: .6em; }
.post-file { margin: 1rem 0; }

.post-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: 2.25rem; padding-top: 1.25rem; border-top: 2px dashed var(--c-border); }
.post-section { margin-top: 3rem; }
.post-section > h2 { display: flex; align-items: center; gap: .6rem; }
.post-section > h2::before { content: ""; flex-shrink: 0; width: 12px; height: 28px; border-radius: 4px; background: var(--c-green); box-shadow: 3px 3px 0 var(--c-sun); }

/* Sidebar: table of contents + share */
.post-aside { display: grid; gap: 1rem; align-content: start; }
.post-toc, .post-share { background: #fff; border: 1px solid var(--c-border); border-radius: 20px; padding: 1.1rem 1.15rem; box-shadow: var(--shadow-sm); }
.post-toc h2, .post-share h2 { margin: 0 0 .6rem; font-size: 1rem; }
.post-toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: .1rem; counter-reset: toc; }
.post-toc li a { display: block; padding: .3rem .6rem; border-radius: 10px; color: #3d4a35; text-decoration: none; font-size: .9rem; line-height: 1.7; border-inline-start: 3px solid transparent; }
.post-toc li.is-sub a { padding-inline-start: 1.4rem; font-size: .85rem; }
.post-toc li a:hover { background: var(--c-green-wash); color: var(--c-green-dd); }
.post-toc li a.is-active { border-inline-start-color: var(--c-green); background: var(--c-green-wash); color: var(--c-green-dd); font-weight: 800; }
.post-share-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.post-share-links a, .post-share-links button {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem; min-height: 40px; padding: .3rem .85rem;
  border-radius: 999px; border: 1.5px solid var(--c-border); background: #fff; color: var(--c-text);
  font: inherit; font-size: .85rem; font-weight: 800; text-decoration: none; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.post-share-links a:hover, .post-share-links button:hover { border-color: var(--c-green-dd); background: var(--c-green-wash); }
.post-share-links button.is-done { background: var(--c-green); color: #fff; border-color: var(--c-green); }

/* ---- dynamic game card ---- */
.post-game-list { display: grid; gap: 1rem; }
.post-game-card {
  display: grid; grid-template-columns: 1fr; overflow: hidden; margin: 1.75rem 0;
  border: 2px solid var(--c-green-dd); border-radius: 22px; background: var(--c-surface); box-shadow: var(--shadow-hard);
  line-height: 1.7;
}
.post-game-list .post-game-card { margin: 0; }
.post-game-card-media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--c-bg); }
.post-game-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease); }
.post-game-card:hover .post-game-card-media img { transform: scale(1.05); }
.post-game-card-body { padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .4rem; }
.post-game-card-kicker { margin: 0; color: var(--c-green-d); font-size: .85rem; font-weight: 800; }
.post-game-card-title { margin: 0; font-size: 1.22rem; }
.post-game-card-title a { color: inherit; text-decoration: none; }
.post-body .post-game-card-title a { color: inherit; font-weight: 900; }
.post-body .post-game-card-title a:hover { background: none; color: var(--c-green-d); }
.post-game-card-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem .9rem; color: var(--c-muted); font-size: .9rem; }
.post-body .post-game-card-facts li::marker { content: none; }
.post-game-card-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.post-body .post-game-card-actions a { text-decoration: none; }
.post-body .post-game-card-actions a.btn-primary { color: #fff; }
.post-body .post-game-card-actions a.btn-primary:hover { background: var(--c-primary-d); color: #fff; }

@media (min-width: 640px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
  .post-game-card { grid-template-columns: 38% 1fr; }
  .post-game-card-media { aspect-ratio: auto; height: 100%; }
}
@media (min-width: 1024px) {
  .post-grid { grid-template-columns: repeat(3, 1fr); }
  .post-grid.has-lead > .post-card:first-child { grid-column: span 2; grid-row: span 2; }
  .post-grid.has-lead > .post-card:first-child .post-card-media { aspect-ratio: 16 / 10; }
  .post-shell { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
  .post-aside { position: sticky; top: calc(var(--header-h) + 1.25rem); max-height: calc(100vh - var(--header-h) - 2.5rem); overflow-y: auto; }
}
@media print {
  .blog-search, .blog-cats, .post-game-card-actions, .post-aside { display: none; }
  .post-article { border: 0; box-shadow: none; padding: 0; }
}
