button.filter {
  font: inherit;
  cursor: pointer;
}

html {
  min-height: 100%;
}

body {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
}

body > main {
  flex: 1 0 auto;
}

body > .site-footer {
  flex: 0 0 auto;
}

/* Shared brand navigation for article pages */
.nav {
  height: 64px;
  color: rgba(16, 18, 20, 0.78);
  border-bottom-color: rgba(101, 71, 220, 0.1);
  background:
    linear-gradient(90deg, rgba(231, 237, 242, 0.46), rgba(255, 255, 255, 0.14) 48%, rgba(57, 68, 80, 0.1)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(220, 225, 245, 0.18)),
    url("image/background-poster.jpg") center 42% / cover no-repeat;
  box-shadow: 0 10px 34px rgba(57, 65, 112, 0.1);
  backdrop-filter: blur(14px) saturate(0.9);
}

.nav .brand {
  color: rgba(16, 18, 20, 0.84);
}

.nav .links a {
  padding: 8px 12px;
  border-radius: 8px;
  color: rgba(16, 18, 20, 0.64);
  font-size: 15px;
  transition: color 160ms ease, background 160ms ease;
}

.nav .links a:hover,
.nav .links a[aria-current="page"] {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.24);
}

.nav .menu-button span,
.nav .menu-button span::before,
.nav .menu-button span::after {
  background: var(--ink);
}

.content-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 52px 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
}

.content-state.is-error {
  color: #9e3550;
}

.content-state a,
.article-body a {
  color: var(--violet);
  text-underline-offset: 3px;
}

.article-body img,
.article-body video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 28px auto;
  border-radius: 14px;
}

.article-body table {
  display: block;
  width: 100%;
  margin: 28px 0;
  overflow-x: auto;
  border-collapse: collapse;
}

.article-body th,
.article-body td {
  padding: 10px 14px;
  border: 1px solid var(--line);
  text-align: left;
}

.toc[hidden] {
  display: none;
}

.toc span {
  color: var(--muted);
  font-size: 13px;
}

.toc .toc-level-3 {
  padding-left: 12px;
}

.article-nav strong {
  line-height: 1.45;
}

.article-nav a:only-child {
  grid-column: 1 / -1;
}

/* Article index */
#article-list {
  margin-top: 64px;
  padding-top: 36px;
}

#article-categories {
  align-items: flex-end;
  margin-bottom: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.filters {
  gap: 4px;
}

button.filter {
  padding: 8px 13px;
  border-color: transparent;
  background: transparent;
}

button.filter:hover {
  color: var(--violet);
  background: var(--soft);
}

button.filter.active {
  border-color: transparent;
  background: var(--soft);
}

#article-grid {
  display: block;
}

#article-grid .article-card {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr) 128px;
  grid-template-rows: auto auto;
  column-gap: 30px;
  min-height: 0;
  padding: 30px 10px;
  border: 0;
  border-bottom: 1px solid rgba(101, 71, 220, 0.12);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#article-grid .article-card::before {
  display: none;
}

#article-grid .article-card:hover {
  transform: none;
  border-color: rgba(101, 71, 220, 0.28);
  background: linear-gradient(90deg, rgba(101, 71, 220, 0.035), transparent 72%);
  box-shadow: none;
}

#article-grid .card-top {
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 9px;
  padding-top: 4px;
}

#article-grid .article-card h2 {
  grid-column: 2;
  grid-row: 1;
  margin: 0 0 9px;
  font-size: clamp(20px, 2vw, 27px);
  line-height: 1.35;
}

#article-grid .article-card p {
  grid-column: 2;
  grid-row: 2;
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#article-grid .card-meta {
  grid-column: 3;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0;
  padding: 4px 0 2px;
}

/* Article detail */
.article-layout {
  grid-template-columns: minmax(0, 780px) 230px;
  gap: 64px;
  margin-top: 64px;
  padding-top: 62px;
}

.article-header h1 {
  max-width: 760px;
  font-size: clamp(30px, 3.4vw, 40px);
  line-height: 1.24;
  letter-spacing: -0.035em;
}

.article-info {
  padding: 18px 0 24px;
}

.article-body {
  padding-top: 12px;
}

.article-body h2 {
  margin: 42px 0 14px;
  font-size: 24px;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.article-body h3 {
  margin: 32px 0 12px;
  font-size: 19px;
  line-height: 1.45;
}

@media (max-width: 820px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .nav {
    height: 56px;
    width: 100%;
    max-width: 100vw;
  }

  .nav .links {
    top: 56px;
    border-color: rgba(16, 18, 20, 0.1);
    background:
      linear-gradient(145deg, rgba(236, 240, 247, 0.88), rgba(217, 222, 245, 0.82)),
      url("image/background-poster.jpg") center / cover no-repeat;
    box-shadow: 0 18px 50px rgba(35, 44, 75, 0.18);
    backdrop-filter: blur(18px);
  }

  #article-list {
    margin-top: 56px;
  }

  .nav .links a {
    color: rgba(16, 18, 20, 0.68);
    border-color: rgba(16, 18, 20, 0.08);
    background: rgba(255, 255, 255, 0.2);
  }

  .nav .links a:hover,
  .nav .links a[aria-current="page"] {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.42);
  }

  #article-grid .article-card {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 0 18px;
    padding: 24px 4px;
  }

  #article-grid .card-top {
    grid-column: 1 / 3;
    grid-row: 1;
    flex-direction: row;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 0;
  }

  #article-grid .article-card h2 {
    grid-column: 1 / 3;
    grid-row: 2;
  }

  #article-grid .article-card p {
    grid-column: 1;
    grid-row: 3;
  }

  #article-grid .card-meta {
    grid-column: 2;
    grid-row: 3;
    justify-content: flex-end;
  }

  .article-layout {
    display: block;
    width: calc(100% - 36px);
    max-width: calc(100% - 36px);
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin-top: 56px;
    padding-top: 46px;
  }

  #article-content > article {
    min-width: 0;
    width: 100%;
  }

  .article-header,
  .article-body,
  .breadcrumb,
  .article-nav {
    min-width: 0;
    max-width: 100%;
  }

  .article-header h1 {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .article-body {
    width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .article-body > *,
  .article-body p,
  .article-body div,
  .article-body span {
    max-width: 100% !important;
  }

  .article-body pre,
  .article-body table {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  #article-categories {
    align-items: flex-start;
    gap: 14px;
  }

  .article-layout {
    padding-top: 36px;
  }

  .breadcrumb {
    margin-bottom: 22px;
    line-height: 1.7;
  }

  .article-header h1 {
    font-size: 30px;
  }

  .article-body h2 {
    font-size: 22px;
  }

  .article-body h3 {
    font-size: 18px;
  }
}
