/* ==========================================================================
   Solutions Lanka — Updates & recent work (posts)
   Builds on the variables and classes of style.css.
   ========================================================================== */

/* ---------- Hero ---------- */
.hero-posts { padding-bottom: clamp(56px, 7vw, 88px); }
.hero-posts .lead { margin-top: 24px; }

.hero-post { padding-bottom: clamp(48px, 6vw, 72px); }
.post-narrow { max-width: calc(820px + var(--gutter) * 2); }
.hero-post .crumbs span[aria-current] { max-width: min(40ch, 100%); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 22px; }
.post-date { font-family: var(--f-mono); font-size: 13px; color: var(--muted-d); }
.post-title { font-size: clamp(2.1rem, 4.6vw, 3.8rem); line-height: 1.02; text-wrap: balance; overflow-wrap: anywhere; }
.post-lead { margin-top: 22px; }

/* ---------- Chips ---------- */
.post-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(28px, 4vw, 44px); }
.post-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--white); color: var(--text);
  font-size: 14px; font-weight: 500; line-height: 1.2;
  transition: background .2s, border-color .2s, color .2s;
}
a.post-chip:hover { border-color: var(--text); }
.post-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--white); }
.post-chip-n { font-family: var(--f-mono); font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--paper); color: var(--muted); }
.post-chip.is-active .post-chip-n { background: var(--accent); color: var(--accent-ink); }

.post-chip-dark { background: rgba(200, 240, 49, .1); border-color: rgba(200, 240, 49, .35); color: var(--accent); padding: 7px 14px; font-size: 13.5px; }
a.post-chip-dark:hover { background: rgba(200, 240, 49, .18); border-color: var(--accent); }
.post-chip-dark .logo-mark-xs { color: var(--text-d); }

/* ---------- Cards ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.post-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform .35s var(--ease), border-color .3s, box-shadow .35s var(--ease);
}
.post-card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: 0 24px 60px -28px rgba(14, 18, 23, .35); }
/* style.css's reveal rules (.js [data-reveal] / .is-in) are more specific: keep the hover lift and shadow transition */
.js .post-card[data-reveal] { transition: opacity .8s var(--ease), transform .8s var(--ease), border-color .3s, box-shadow .35s var(--ease); }
.js .post-card[data-reveal].is-in { transition: opacity .8s var(--ease), transform .35s var(--ease), border-color .3s, box-shadow .35s var(--ease); }
.js .post-card[data-reveal].is-in:hover { transform: translateY(-4px); }
.post-card:focus-within { border-color: var(--text); }
.post-card-media { aspect-ratio: 16 / 10; background: var(--ink-2); overflow: hidden; }
.post-card-img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.post-card:hover img.post-card-img { transform: scale(1.04); }

/* Placeholder when there is no cover photo */
.post-ph {
  position: relative; display: grid; place-items: center; width: 100%; height: 100%;
  background:
    radial-gradient(circle at 75% 20%, rgba(200, 240, 49, .18), transparent 55%),
    var(--ink-2);
  color: var(--accent);
}
.post-ph::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 20%, transparent 80%);
          mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 20%, transparent 80%);
}
.post-ph-icon { position: relative; width: 56px; height: 56px; color: var(--accent); stroke-width: 1.4; transition: transform .4s var(--ease); }
svg.post-ph-icon:not(.icon) { color: var(--text-d); }
.post-card:hover .post-ph-icon { transform: rotate(-6deg) scale(1.06); }

.post-card-body { display: flex; flex-direction: column; flex: 1; padding: 22px 24px 24px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.post-cat { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text); }
.post-card-title { margin-top: 14px; font-family: var(--f-display); font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
/* The whole card is clickable through the title link */
.post-card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.post-card-title a:focus-visible { outline: none; }
.post-card-title a:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--r-lg); }
.post-card-text { margin-top: 10px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.post-card-more { margin-top: auto; padding-top: 20px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.post-card-more .icon { transition: transform .3s var(--ease); }
.post-card:hover .post-card-more .icon { transform: translateX(4px); }

/* ---------- Pagination ---------- */
.post-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 40px; }
.post-pager-info { font-family: var(--f-mono); font-size: 13px; color: var(--muted); }
.post-pager .is-disabled { opacity: .35; pointer-events: none; }
.posts-list .cta-band, .post-more .cta-band { margin-top: clamp(40px, 5vw, 64px); }

/* ---------- Single post ---------- */
.post-main { padding: clamp(40px, 5vw, 64px) 0 clamp(56px, 7vw, 88px); }
.post-cover { margin: 0 0 clamp(32px, 4vw, 48px); border-radius: var(--r-lg); overflow: hidden; background: var(--ink-2); border: 1px solid var(--line); }
.post-cover-img { width: 100%; height: auto; max-height: 560px; object-fit: cover; }

.post-body { font-size: 1.09rem; line-height: 1.75; color: var(--text); overflow-wrap: break-word; }
.post-body > * + * { margin-top: 1.15em; }
.post-body h2 { margin-top: 1.9em; font-family: var(--f-display); font-size: clamp(1.55rem, 2.6vw, 2rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.post-body h3 { margin-top: 1.6em; font-family: var(--f-display); font-size: clamp(1.2rem, 2vw, 1.4rem); font-weight: 700; letter-spacing: -.015em; line-height: 1.25; }
.post-body h2 + *, .post-body h3 + * { margin-top: .6em; }
.post-body > :first-child { margin-top: 0; }
.post-body ul, .post-body ol { padding-left: 1.4em; display: grid; gap: .45em; }
.post-body ul { list-style: none; padding-left: 1.5em; }
.post-body ul li { position: relative; }
.post-body ul li::before { content: ""; position: absolute; left: -1.15em; top: .68em; width: 7px; height: 7px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 3px rgba(200, 240, 49, .6); }
.post-body ol { list-style: decimal; }
.post-body ol li::marker { font-family: var(--f-mono); font-size: .9em; color: var(--muted); }
.post-body blockquote { margin: 1.6em 0; padding: 18px 24px; border-left: 4px solid var(--accent); background: var(--white); border-radius: 0 var(--r) var(--r) 0; font-size: 1.12em; color: var(--text); }
.post-body blockquote p { margin: 0; }
.post-body a { text-decoration: underline; text-decoration-color: rgba(14, 18, 23, .35); text-decoration-thickness: 1.5px; text-underline-offset: 3px; font-weight: 500; transition: text-decoration-color .2s, background .2s; }
.post-body a:hover { text-decoration-color: var(--text); background: rgba(200, 240, 49, .35); }
.post-body strong { font-weight: 650; }
.post-body em { font-style: italic; }

.post-share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: clamp(40px, 5vw, 56px); padding-top: 24px; border-top: 1px solid var(--line); }
.post-share-label { font-family: var(--f-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.post-share-btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); font-weight: 600; font-size: 14px; transition: border-color .2s, background .2s, color .2s; }
.post-share-btn.is-wa .icon { color: var(--wa); }
.post-share-btn.is-fb .icon { color: #1877F2; }
.post-share-btn:hover { border-color: var(--text); }
.post-share-back { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--muted); transition: color .2s; }
.post-share-back:hover { color: var(--text); }

.post-more-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.post-more .post-grid + .cta-band { margin-top: clamp(40px, 5vw, 64px); }
.post-more .post-more-head ~ .cta-band { margin-top: clamp(40px, 5vw, 64px); }
.post-more .container > .cta-band:first-child { margin-top: 0; }

/* ---------- Preview ribbon (admin preview only) ---------- */
.post-ribbon {
  position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: #FFB547; color: var(--accent-ink);
  font-weight: 600; font-size: 14px; line-height: 1.2;
  box-shadow: 0 14px 40px -12px rgba(0, 0, 0, .6);
  pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}

/* ---------- Home page block ---------- */
.posts-latest-side { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.posts-latest .h2 .post-em { font-style: normal; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .post-grid { grid-template-columns: 1fr; }
  .post-chips { flex-wrap: nowrap; overflow-x: auto; margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1); padding: 0 var(--gutter) 4px; scrollbar-width: none; }
  .post-chips::-webkit-scrollbar { display: none; }
  .post-chip { flex: none; }
  .post-pager { flex-wrap: wrap; justify-content: center; }
  .post-pager-info { order: -1; width: 100%; text-align: center; }
  .post-body { font-size: 1.03rem; }
  .post-share-back { margin-left: 0; width: 100%; }
  .post-more-head { flex-wrap: wrap; align-items: center; }
  .post-ribbon { bottom: 84px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .post-card, .post-card-img, .post-ph-icon, .post-card-more .icon { transition: none; }
  .post-card:hover, .js .post-card[data-reveal].is-in:hover, .post-card:hover img.post-card-img, .post-card:hover .post-ph-icon { transform: none; }
  .js .post-card[data-reveal], .js .post-card[data-reveal].is-in { transition: none; }
}
