/* Klinik Blog · Material You · class names unchanged, skin swapped */

/* ---- base ---- */
* {
  box-sizing: border-box;
}
html,
body {
  overflow-x: clip;
}
html {
  background: var(--color-surface);
}
body {
  margin: 0;
  background: var(--color-surface);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
  min-width: 0;
  color: var(--color-on-surface);
}
a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-full);
}
::selection {
  background: var(--color-secondary-container);
}

/* ---- header: elevated app bar with blur ---- */
.nav-mast {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  gap: var(--space-2xs);
  padding: var(--space-sm) var(--page-gutter);
  background: rgb(255 251 254 / 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgb(121 116 126 / 0.2);
  text-align: center;
}
.mast-name {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  text-align: center;
}
.mast-name a {
  color: var(--color-primary);
  text-decoration: none;
}
.mast-name a:hover {
  text-decoration: none;
}
.mast-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3xs);
  list-style: none;
  padding: 0;
  margin: 0;
}
.mast-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--color-on-surface-variant);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-md),
    color var(--dur-fast) var(--ease-md);
}
.mast-nav a:hover {
  background: rgb(103 80 164 / 0.1);
  color: var(--color-primary);
  text-decoration: none;
}
.mast-nav a:active {
  background: rgb(103 80 164 / 0.05);
  transform: scale(0.95);
}
.mast-nav a[aria-current="page"] {
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
}
.mast-rule {
  display: none; /* hairline replaced by app-bar border */
}
.mast-rule.double {
  display: none;
}

/* ---- layout ---- */
.page {
  padding: var(--space-xl) var(--page-gutter);
}
.container {
  max-width: 72rem;
  margin-inline: auto;
}

/* ---- home lede: hero card with blur shapes ---- */
.home-lede {
  position: relative;
  max-width: 46rem;
  margin-inline: auto;
  background: var(--color-surface-container);
  border-radius: var(--radius-2xl);
  padding: var(--space-2xl) var(--space-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  isolation: isolate;
}
.home-lede::before,
.home-lede::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  z-index: -1;
}
.home-lede::before {
  width: 18rem;
  height: 18rem;
  top: -8rem;
  right: -6rem;
  background: rgb(103 80 164 / 0.25);
}
.home-lede::after {
  width: 14rem;
  height: 14rem;
  bottom: -7rem;
  left: -5rem;
  background: rgb(125 82 96 / 0.2);
}
.home-lede p {
  margin: 0;
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--color-on-surface-variant);
}

/* ---- latest: tonal cards ---- */
.latest {
  max-width: 46rem;
  margin: var(--space-xl) auto 0;
}
.latest-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding-bottom: var(--space-2xs);
}
.latest-head h2 {
  margin: 0;
  font-size: var(--text-lg);
}
.latest-head .count {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-on-surface-variant);
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  border-radius: var(--radius-full);
  padding: 2px var(--space-2xs);
}
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-sm);
}
.post-list li {
  border-bottom: none;
}
.post-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3xs);
  padding: var(--space-md);
  background: var(--color-surface-container);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur-std) var(--ease-md),
    transform var(--dur-std) var(--ease-md),
    background-color var(--dur-std) var(--ease-md);
}
.post-list a:hover {
  background: var(--color-surface-container-low);
  box-shadow: var(--shadow-2);
  transform: scale(1.02);
  text-decoration: none;
}
.post-list a:active {
  transform: scale(0.98);
}
.post-list a:hover h3 {
  color: var(--color-primary);
}
.post-list h3 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.35;
}
.post-list .meta {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
}

/* ---- categories: pill grid ---- */
.cat-index {
  max-width: 46rem;
  margin: var(--space-xl) auto 0;
}
.cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2xs);
}
.cat-list li {
  border-bottom: none;
}
.cat-list a {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: background-color var(--dur-fast) var(--ease-md),
    transform var(--dur-fast) var(--ease-md);
}
.cat-list a:hover {
  background: rgb(103 80 164 / 0.08);
  text-decoration: none;
}
.cat-list a:active {
  background: rgb(103 80 164 / 0.05);
  transform: scale(0.98);
}
.cat-list a:hover .cat-name {
  color: var(--color-primary);
}
.cat-name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 500;
}
.cat-desc {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  text-align: right;
}

/* ---- article (Long Document, MD3 skin) ---- */
.article {
  max-width: var(--measure);
  margin-inline: auto;
}
.article-header {
  padding: var(--space-md) var(--space-sm);
  margin-bottom: var(--space-lg);
  background: var(--color-surface-container);
  border-radius: var(--radius-lg);
}
.article-header h1 {
  font-size: var(--text-xl);
  line-height: 1.25;
  margin: var(--space-2xs) 0 var(--space-sm);
}
.article-header .meta {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  letter-spacing: 0.01em;
}
.article-header .kicker {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-on-secondary-container);
  background: var(--color-secondary-container);
  border-radius: var(--radius-full);
  text-decoration: none;
}
.article-header .kicker:hover {
  background: rgb(103 80 164 / 0.14);
  text-decoration: none;
}
.article-body p {
  margin: 0 0 var(--space-md);
}
.article-body h2 {
  font-size: var(--text-lg);
  margin: var(--space-lg) 0 var(--space-sm);
}
.article-body h3 {
  font-size: var(--text-md);
  margin: var(--space-md) 0 var(--space-xs);
}
.article-body ul,
.article-body ol {
  padding-left: var(--space-lg);
  margin: 0 0 var(--space-md);
}
.article-body li {
  margin-bottom: var(--space-2xs);
}
.article-body blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-container);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-on-surface-variant);
}
.article-body blockquote p {
  margin: 0;
}
.article-body strong {
  font-weight: 700;
  color: var(--color-on-surface);
}
.article-body em {
  font-style: italic;
}
.article-body code {
  font-family: ui-monospace, "Roboto Mono", monospace;
  font-size: 0.9em;
  background: var(--color-surface-container-low);
  border-radius: var(--radius-xs);
  padding: 2px var(--space-2xs);
}
.article-body table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: var(--space-md) 0;
  font-size: var(--text-sm);
  background: var(--color-surface-container);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.article-body th,
.article-body td {
  padding: var(--space-2xs) var(--space-sm);
  text-align: left;
  border-bottom: 1px solid rgb(121 116 126 / 0.2);
}
.article-body th {
  font-weight: 500;
  background: var(--color-surface-container-low);
}
.article-body tr:last-child td {
  border-bottom: none;
}
.article-body hr {
  border: 0;
  height: 1px;
  background: rgb(121 116 126 / 0.2);
  margin: var(--space-lg) 0;
}

/* references */
.article-body .references,
.article-body .references + * {
  font-size: var(--text-sm);
}
.article-body .references {
  list-style: none;
  padding: 0;
}
.article-body .references li {
  margin-bottom: var(--space-2xs);
  padding: var(--space-2xs) var(--space-sm);
  background: var(--color-surface-container);
  border-radius: var(--radius-sm);
  text-indent: 0;
}

/* disclaimer: tonal note */
.disclaimer {
  max-width: var(--measure);
  margin: var(--space-lg) auto 0;
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.disclaimer strong {
  color: var(--color-on-secondary-container);
  font-weight: 700;
  display: block;
  margin-bottom: var(--space-3xs);
}

/* ---- footer ---- */
.foot-dense {
  background: var(--color-surface-container);
  margin-top: var(--space-2xl);
  padding: var(--space-lg) var(--page-gutter) var(--space-xl);
}
.foot-dense p {
  max-width: var(--measure);
  margin: 0 auto;
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  text-align: center;
}

/* ---- responsive ---- */
@media (max-width: 480px) {
  .article-header h1 {
    font-size: var(--text-md);
  }
  .cat-list a {
    grid-template-columns: minmax(0, 1fr);
  }
  .cat-desc {
    text-align: left;
  }
  .article-body table {
    display: block;
    overflow-x: auto;
  }
  .home-lede {
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-md);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
