/* ==================================================================
   content.css — Portfolio (projects) + Articles + shared UI
   Uses the tokens defined in main.css. Loaded by: index, projects,
   articles, every project/article page, and 404.
   ================================================================== */

:root {
  --ink: #14161a;
  --card-border: #dfe2e6;
  --radius-lg: 18px;
  --radius-md: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.container--narrow { max-width: 780px; }

/* ---------- pill / badge ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #f0f1f3;
  color: #2a2c31;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.pill--light { background: rgba(255, 255, 255, 0.14); color: #fff; }
.pill--badge {
  min-height: 32px;
  padding: 6px 15px;
  border: 1px solid var(--section-border-color);
  background: var(--widget-background-color);
  color: var(--widget-text-color);
  font-size: var(--section-text-small);
}

/* ---------- buttons ---------- */
.btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 10px;
  font-size: var(--section-text-medium);
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background-color 0.25s ease, color 0.25s ease;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: #000; color: #fff; }
.btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../assets/img/site-background.webp") center / cover no-repeat;
  transition: opacity 0.5s ease;
  z-index: -1;
}
.btn--primary:hover::before { opacity: 0.4; }
.btn--secondary { background: transparent; color: #000; box-shadow: inset 0 0 0 1px #000; }
.btn--secondary:hover { background: #000; color: #fff; }
.btn--light { background: #fff; color: #000; }
.btn--light:hover { background: #e9eaec; }

/* ---------- section heading (home + reuse) ---------- */
.section-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 720px;
  margin: 0 auto 40px;
  text-align: center;
  gap: 14px;
}
.section-head__heading { font-family: var(--heading-display-font); }
.section-head__text { color: var(--section-text-alternate-color); line-height: 1.65; }

/* ---------- page hero (listing pages) ---------- */
.page-hero { padding: 56px 0 28px; }
.page-hero--tall { padding: 120px 0; }
.page-hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  gap: 16px;
}
.page-hero__heading { font-family: var(--heading-display-font); }
.page-hero__text { max-width: 620px; color: var(--section-text-alternate-color); line-height: 1.65; }

/* ---------- filters ---------- */
.listing { padding: 16px 0 72px; }
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
/* chips + search need JS; without it everything is simply shown */
.filters, .filter-search, .filter-status { display: none; }
.js .filters { display: flex; flex-wrap: wrap; gap: 8px; }
.js .filter-search { display: flex; }
.js .filter-status { display: block; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: #fff;
  color: #2a2c31;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.filter-chip:hover { border-color: #000; }
.filter-chip.is-active { background: #000; border-color: #000; color: #fff; }
.filter-chip__count {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.07);
  font-size: 11px;
  text-align: center;
}
.filter-chip.is-active .filter-chip__count { background: rgba(255, 255, 255, 0.2); }

.filter-search {
  position: relative;
  align-items: center;
  width: 100%;
  max-width: 280px;
}
.filter-search svg { position: absolute; left: 14px; width: 16px; height: 16px; color: #6b6e75; pointer-events: none; }
.filter-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
}
.filter-search input:focus-visible { border-color: #000; }
.filter-status { margin: 0 0 18px; color: #6b6e75; font-size: 13px; min-height: 20px; }
.filter-empty { padding: 56px 0; text-align: center; color: var(--section-text-alternate-color); }
.filter-empty .btn { margin-top: 16px; }

@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.is-entering { animation: cardIn 0.45s var(--ease) both; }

/* ---------- project cards ---------- */
.work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.work-grid--featured { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

.work-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background: #fff;
  transition: transform 0.45s var(--ease), box-shadow 0.45s ease;
}
.work-card:hover { transform: translateY(-5px); box-shadow: 0 18px 45px rgba(20, 22, 26, 0.08); }
.work-card:focus-within { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111; }

.work-media {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 20% 10%, rgba(255, 255, 255, 0.75), transparent 60%),
    var(--accent, #ececee);
}
.work-media--card { aspect-ratio: 4 / 2; border-bottom: 1px solid #eef0f2; }
.work-media--hero { aspect-ratio: 16 / 8; border-radius: var(--radius-lg); border: 1px solid var(--card-border); margin-bottom: 20px; }
.work-media__logo { width: auto; max-width: 46%; max-height: 38%; object-fit: contain; transition: transform 0.6s var(--ease); }
.work-card:hover .work-media__logo { transform: scale(1.05); }
.work-media__cover { width: 100%; height: 100%; object-fit: cover; object-position: top center; }

.work-card__body { display: flex; flex-direction: column; flex: 1; gap: 10px; padding: 22px 24px 26px; }
.work-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.work-card__year { color: #6b6e75; font-size: 12px; }
.work-card__title { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; color: var(--ink); }
/* stretched link: the whole card is clickable, but the real link is the title */
.work-card__link::after, .post-card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.work-card__link:focus-visible, .post-card__link:focus-visible { outline: none; box-shadow: none; }
.work-card__text { color: var(--section-text-alternate-color); font-size: 14px; line-height: 1.65; }
.work-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.work-card__tags li { padding: 4px 10px; border-radius: 999px; background: #f4f5f6; color: #44454c; font-size: 12px; }
.work-card__arrow {
  position: absolute;
  top: 16px; right: 16px;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translate(-6px, 6px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease);
}
.work-card__arrow svg { width: 16px; height: 16px; }
.work-card:hover .work-card__arrow, .work-card:focus-within .work-card__arrow { opacity: 1; transform: none; }

.work-section { padding: 56px 0 24px; }
.work-section__more { display: flex; justify-content: center; margin-top: 32px; }

/* ---------- article cards ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 26px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background: #fff;
  transition: transform 0.45s var(--ease), box-shadow 0.45s ease;
}
.post-card:hover { transform: translateY(-5px); box-shadow: 0 18px 45px rgba(20, 22, 26, 0.08); }
.post-card:focus-within { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111; }
.post-card--case { background: var(--ink); border-color: var(--ink); color: #fff; }
.post-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.post-card__read { font-size: 12px; color: #6b6e75; }
.post-card--case .post-card__read { color: #a9acb3; }
.post-card__title { font-size: 20px; font-weight: 500; line-height: 1.3; letter-spacing: -0.015em; }
.post-card__text { font-size: 14px; line-height: 1.65; color: var(--section-text-alternate-color); }
.post-card--case .post-card__text { color: #c4c7cd; }
.post-card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; font-size: 13px; color: #6b6e75; }
.post-card--case .post-card__foot { color: #a9acb3; }
.post-card__go { display: inline-flex; align-items: center; gap: 4px; color: #000; font-weight: 500; }
.post-card--case .post-card__go { color: #fff; }
.post-card__go svg { width: 14px; height: 14px; transition: transform 0.3s var(--ease); }
.post-card:hover .post-card__go svg { transform: translate(2px, -2px); }

/* ---------- detail pages (shared) ---------- */
.detail, .article { padding: 28px 0 24px; }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; font-size: 13px; color: #6b6e75; }
.breadcrumb a:hover { color: #000; text-decoration: underline; }
.breadcrumb [aria-current] { color: #000; }

.detail-head, .article-head { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 32px; }
.detail-head { max-width: 780px; }
.detail-head__heading, .article-head__heading { font-family: var(--heading-display-font); font-size: clamp(36px, 6vw, 60px); line-height: 1.08; letter-spacing: -0.02em; }
.article-head__heading { font-size: clamp(30px, 5vw, 46px); }
.detail-head__text, .article-head__text { font-size: var(--section-text-large); line-height: 1.6; color: var(--section-text-alternate-color); }
.detail-head__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.detail-head__actions--center { justify-content: center; margin-top: 8px; }
.article-head__meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: #6b6e75; }

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 0 0 48px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card-border);
}
.detail-meta > div { padding: 16px 20px; background: #fff; }
.detail-meta dt { font-size: 12px; color: #6b6e75; }
.detail-meta dd { margin-top: 2px; font-weight: 500; }

.detail-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 48px; align-items: start; }
.detail-aside { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 14px; }
.aside-card { padding: 22px; border: 1px solid var(--card-border); border-radius: var(--radius-md); background: #fff; }
.aside-card h2 { margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.aside-card ul:not(.chips) { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: #44454c; }
.aside-card ul:not(.chips) li::before { content: "—"; margin-right: 8px; color: #9a9da4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { padding: 5px 11px; border-radius: 999px; background: #f0f1f3; font-size: 12px; font-weight: 500; color: #2a2c31; }
.chips--tags { margin: 32px 0; }

/* ---------- prose ---------- */
.prose { color: #2a2c31; font-size: 16px; line-height: 1.8; }
.prose-block + .prose-block { margin-top: 40px; }
.prose h2 { margin: 44px 0 14px; font-family: var(--heading-display-font); font-size: 28px; line-height: 1.2; letter-spacing: -0.015em; color: #000; scroll-margin-top: 90px; }
.prose-block h2, .prose > h2:first-child { margin-top: 0; }
.prose h3 { margin: 32px 0 10px; font-size: 20px; font-weight: 600; scroll-margin-top: 90px; }
.prose p { margin-bottom: 18px; }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 4px; }
.prose ul li, .prose ol li { position: relative; margin-bottom: 8px; padding-left: 24px; }
.prose ul li::before { content: ""; position: absolute; left: 6px; top: 0.8em; width: 6px; height: 6px; border-radius: 50%; background: #000; }
.prose ol { counter-reset: item; }
.prose ol li { counter-increment: item; }
.prose ol li::before { content: counter(item) "."; position: absolute; left: 0; font-weight: 600; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose code { padding: 2px 6px; border-radius: 6px; background: #ececee; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; }
.prose blockquote { margin: 24px 0; padding: 4px 0 4px 20px; border-left: 3px solid #000; color: #44454c; }
.prose--article { font-size: 17px; }

/* code blocks */
.code-block { margin: 24px 0 28px; overflow: hidden; border-radius: var(--radius-md); background: var(--ink); }
.code-block__bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.code-block__lang { color: #a9acb3; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.code-block__copy { padding: 6px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 12px; font-weight: 500; cursor: pointer; transition: background-color 0.2s ease; }
.code-block__copy:hover { background: rgba(255, 255, 255, 0.2); }
.code-block__copy:focus-visible { outline-color: #fff; box-shadow: none; }
.code-block pre { margin: 0; padding: 18px 20px; overflow-x: auto; }
.code-block code { display: block; padding: 0; background: none; color: #e8e9ec; font-size: 13.5px; line-height: 1.7; white-space: pre; }
.prose .code-block code { padding: 0; background: none; }

/* table of contents */
.toc { margin-bottom: 36px; padding: 20px 24px; border: 1px solid var(--card-border); border-radius: var(--radius-md); background: #fff; }
.toc strong { display: block; margin-bottom: 8px; font-size: 14px; }
.toc ol { display: flex; flex-direction: column; gap: 6px; font-size: 14px; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc li::before { content: counter(toc) "."; margin-right: 8px; color: #9a9da4; }
.toc a { color: #44454c; }
.toc a:hover { color: #000; text-decoration: underline; }

.author-box { display: flex; align-items: center; gap: 16px; margin-top: 8px; padding: 20px; border: 1px solid var(--card-border); border-radius: var(--radius-md); background: #fff; }
.author-box img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: top; filter: grayscale(1); flex: none; }
.author-box p { margin-top: 2px; font-size: 14px; color: #44454c; }
.author-box a { text-decoration: underline; text-underline-offset: 3px; }

.read-progress { position: fixed; top: 0; left: 0; z-index: 10000; width: 100%; height: 3px; background: #000; transform: scaleX(0); transform-origin: 0 50%; }

/* ---------- related / prev-next ---------- */
.related { margin-top: 72px; }
.related__heading { margin-bottom: 20px; font-family: var(--heading-display-font); font-size: 28px; }
.detail-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.detail-nav__item { display: flex; flex-direction: column; gap: 4px; padding: 22px 24px; border: 1px solid var(--card-border); border-radius: var(--radius-md); background: #fff; transition: border-color 0.2s ease, transform 0.3s var(--ease); }
.detail-nav__item:hover { border-color: #000; transform: translateY(-2px); }
.detail-nav__item span { font-size: 12px; color: #6b6e75; }
.detail-nav__item strong { font-size: 18px; font-weight: 500; }
.detail-nav__item--next { text-align: right; }

/* ---------- CTA band ---------- */
.cta-band-section { padding: 72px 0 40px; }
.cta-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 40px;
  border-radius: 24px;
  background: var(--ink);
  color: #fff;
}
.cta-band__heading { font-family: var(--heading-display-font); font-size: clamp(24px, 4vw, 34px); }
.cta-band__text { margin-top: 8px; color: #c4c7cd; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .work-grid, .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: 1fr; gap: 32px; }
  .detail-aside { position: static; flex-direction: row; flex-wrap: wrap; }
  .detail-aside .aside-card { flex: 1 1 240px; }
}
@media (max-width: 640px) {
  .work-grid, .work-grid--featured, .post-grid { grid-template-columns: 1fr; }
  .work-card__arrow { opacity: 1; transform: none; }
  .page-hero { padding-top: 36px; }
  .cta-band { padding: 28px; }
  .detail-nav { grid-template-columns: 1fr; }
  .detail-nav__item--next { text-align: left; }
  .filter-search { max-width: none; }
  .work-media--hero { aspect-ratio: 4 / 3; }
}
@media (prefers-reduced-motion: reduce) {
  .work-card, .post-card, .btn, .work-media__logo, .detail-nav__item { transition: none; }
  .work-card:hover, .post-card:hover { transform: none; }
  .is-entering { animation: none; }
}
