/* Content pages: project details, blog list, blog posts, media components, lightbox. */

/* ---------- Article prose ---------- */

.content {
  width: min(100% - 40px, 860px);
  margin: 0 auto;
  padding-top: 24px;
}

.content-header {
  margin-bottom: 32px;
}

.content-category {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  margin-top: 12px;
  font-size: 0.9rem;
  opacity: 0.85;
}

.prose {
  overflow-wrap: anywhere;
}

.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  margin: 2.2em 0 0.6em;
  line-height: 1.3;
  scroll-margin-top: 24px;
}

.prose h2 {
  padding-bottom: 6px;
  border-bottom: 2px solid var(--card-bg);
  font-size: 1.6rem;
}

.prose h3 {
  font-size: 1.28rem;
}

.prose h4 {
  font-size: 1.08rem;
}

.prose p,
.prose ul,
.prose ol,
.prose table,
.prose blockquote,
.prose pre {
  margin: 0 0 1.1em;
}

.prose li + li {
  margin-top: 0.25em;
}

.prose img {
  display: block;
  height: auto;
  margin: 1em auto;
  border-radius: 6px;
}

.prose hr {
  margin: 2.5em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose blockquote {
  padding: 12px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--card-bg);
  color: #3a3a44;
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.prose th,
.prose td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.prose th {
  background: var(--card-bg);
}

/* ---------- Code ---------- */

.prose code,
.prose kbd {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.prose :not(pre) > code {
  padding: 0.12em 0.4em;
  border-radius: 4px;
  background: var(--card-bg);
  color: #a33f48;
}

.prose pre {
  position: relative;
  overflow-x: auto;
  border-radius: var(--radius);
  background: #1e1f24;
  font-size: 0.88rem;
  line-height: 1.55;
}

.prose pre code {
  display: block;
  padding: 16px 18px;
  background: transparent;
  color: #e6e6e6;
}

.prose pre code.hljs {
  padding: 16px 18px;
  background: transparent;
}

.prose pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 6px;
  right: 10px;
  color: #8b8d98;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.math-block {
  margin: 1.2em 0;
  overflow-x: auto;
  text-align: center;
}

/* ---------- Media components ---------- */

.media-video {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 1.5em 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}

.media-video--9x16 {
  aspect-ratio: 9 / 16;
  max-width: 420px;
  margin-inline: auto;
}

.media-video--4x3 {
  aspect-ratio: 4 / 3;
}

.media-video iframe,
.media-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

.media-figure,
.gif-grid,
.compare {
  margin: 1.5em 0;
}

.media-figure img {
  margin: 0 auto;
}

figcaption {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.gif-grid,
.compare {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.gif-grid figure,
.compare figure {
  margin: 0;
}

.gif-grid img,
.gif-grid video,
.compare img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border-radius: 6px;
}

@media (min-width: 600px) {
  .gif-grid--2,
  .gif-grid--3,
  .gif-grid--4,
  .compare {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .gif-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .gif-grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.tech-stack li {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--card-bg);
  font-size: 0.82rem;
}

/* ---------- Lightbox ---------- */

[data-lightbox] {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vmin;
  background: rgba(20, 20, 24, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
  cursor: zoom-out;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-caption {
  position: absolute;
  bottom: 14px;
  left: 50%;
  max-width: 90%;
  transform: translateX(-50%);
  color: #ddd;
  font-size: 0.9rem;
  text-align: center;
}

body.lightbox-open {
  overflow: hidden;
}

/* ---------- Blog list ---------- */

.blog-grid {
  display: grid;
  gap: 26px;
  grid-template-columns: 1fr;
}

@media (min-width: 680px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--card-bg);
  color: inherit;
  text-decoration: none;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.post-card:hover,
.post-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.post-card-cover {
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(160deg, transparent 40%, rgba(0, 174, 239, 0.5) 40.5%, rgba(0, 174, 239, 0.5) 46%, transparent 46.5%),
    linear-gradient(150deg, transparent 50%, rgba(236, 0, 140, 0.45) 50.5%, rgba(236, 0, 140, 0.45) 55%, transparent 55.5%),
    linear-gradient(165deg, transparent 58%, rgba(255, 242, 0, 0.6) 58.5%, rgba(255, 242, 0, 0.6) 62%, transparent 62.5%),
    var(--hero-bg);
  background-size: cover;
  background-position: center;
}

.post-card-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 20px;
}

.post-card-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.post-card h2 {
  margin: 0;
  color: var(--accent);
  font-size: 1.15rem;
  line-height: 1.35;
}

.post-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #4a4a55;
  font-size: 0.92rem;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.post-card .tag-list {
  margin-top: auto;
  padding-top: 6px;
}

.empty-state {
  padding: 40px 0;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Project pages ---------- */

.page-hero .content-category {
  color: #fff;
  opacity: 0.75;
}

.content-subtitle {
  font-size: 1.02rem;
}

.post-meta-link {
  color: inherit;
}

.back-link {
  margin-top: 48px;
}

.link-cards {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  margin: 1.5em 0;
}

.prose .link-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--card-bg);
  color: inherit;
  text-decoration: none;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.prose .link-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.prose .link-card-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  margin: 0;
  border-radius: 0;
  object-fit: cover;
}

.link-card-title {
  padding: 12px 14px 2px;
  color: var(--accent);
  font-weight: 600;
}

.link-card-text {
  padding: 0 14px 14px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ---------- Tabs ---------- */

.tabs {
  margin: 2em 0;
}

.tabs-list {
  display: flex;
  flex-wrap: wrap;
  background: #f0f0f0;
}

.tabs-list [role="tab"] {
  position: relative;
  flex: 1 1 140px;
  padding: 14px 16px;
  border: 0;
  background: none;
  color: #3b3b3b;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.tabs-list [role="tab"]:hover {
  background: #e4e4e4;
}

.tabs-list [role="tab"][aria-selected="true"] {
  background: #444;
  color: #fff;
}

.tabs-list [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  border: 8px solid transparent;
  border-top-color: #444;
  border-bottom: 0;
  transform: translateX(-50%);
}

.tab-panel {
  padding-top: 8px;
}

.tab-panel > h2:first-child {
  margin-top: 1em;
}

/* ---------- Post navigation ---------- */

.post-nav {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  margin-top: 60px;
}

@media (min-width: 640px) {
  .post-nav {
    grid-template-columns: 1fr 1fr;
  }
}

.post-nav a {
  display: block;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.post-nav a span {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-nav .post-nav-next {
  text-align: right;
}
