:root {
  color-scheme: dark;
  --bg: #0f1117;
  --text: #e8e6e3;
  --muted: #9ca3af;
  --link: #a5b4fc;
  --card: #1a1d27;
  --border: #2d3348;
  --radius: 12px;
  /* Fixed media measure so wide viewports keep a branded, orderly figure width. */
  --media-max: 36rem;
  --font-body: "Noto Serif", "Noto Serif SC", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-family: var(--font-body);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

html.is-loading .site-main {
  opacity: 0;
}

html.is-ready .site-main {
  opacity: 1;
  transition: opacity 0.2s ease;
}

@view-transition {
  navigation: auto;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.9;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header,
.site-main,
.site-footer {
  width: min(100% - 32px, 760px);
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0;
}

.exp-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}

.exp-header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

.exp-back {
  color: var(--muted);
  font-size: 0.95rem;
  justify-self: start;
}

.exp-back:hover {
  color: var(--text);
  text-decoration: none;
}

.exp-header-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  justify-self: center;
}

.exp-header-switch {
  color: var(--muted);
  font-size: 0.95rem;
  justify-self: end;
}

.exp-header-switch:hover {
  color: var(--text);
  text-decoration: none;
}

.site-title {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.95rem;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.site-nav-icon {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
  object-fit: contain;
  background: none;
  border: 0;
  border-radius: 0;
}

.site-main {
  padding: 48px 0 64px;
}

.site-main:has(.exp-layout) {
  width: 100%;
  margin: 0;
  padding: 0;
}

.exp-layout {
  --exp-sidebar: 288px;
  --exp-max: 1280px;
  min-height: calc(100vh - 140px);
}

.exp-shell {
  display: grid;
  grid-template-columns: var(--exp-sidebar) minmax(0, 1fr);
  gap: 32px;
  width: min(100%, var(--exp-max));
  margin: 0 auto;
  padding: 32px 16px 64px;
  box-sizing: border-box;
}

.exp-sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
}

.exp-sidebar-brand {
  display: flex;
  justify-content: flex-start;
  padding: 0 12px 20px;
}

.exp-sidebar-icon {
  display: block;
  width: 80px;
  height: 80px;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  background: transparent;
}

.exp-sidebar nav {
  display: grid;
  gap: 4px;
}

.exp-sidebar a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.exp-sidebar a:hover {
  color: var(--text);
  background: var(--card);
  text-decoration: none;
}

.exp-sidebar a.is-active {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  font-weight: 500;
}

.exp-main {
  min-width: 0;
  max-width: none;
  transition: opacity 0.18s ease;
}

.exp-main.is-page-loading {
  opacity: 0.35;
  pointer-events: none;
}

.site-footer {
  width: min(100% - 32px, 760px);
  margin: 0 auto;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.hero {
  margin-bottom: 40px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
  font-size: 1.1rem;
  line-height: 1.8;
}

.post-content img.about-avatar {
  width: 160px;
  max-width: min(40vw, 160px);
  height: auto;
  margin: 1.75rem auto 1rem;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  background: transparent;
  cursor: default;
}

.nav-cards {
  display: grid;
  gap: 16px;
  margin-bottom: 40px;
}

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

.nav-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.nav-card:hover {
  text-decoration: none;
  border-color: var(--link);
}

.nav-card-icon-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 160px;
  max-width: min(40vw, 160px);
}

.nav-card-icon {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  background: transparent;
}

.nav-card-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #fff5eb;
  background: linear-gradient(180deg, #ef5350 0%, #c62828 52%, #9b1c1c 100%);
  border: 2px solid #5c1212;
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 210, 160, 0.45),
    0 2px 5px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(198, 40, 40, 0.3);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.nav-card-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.nav-card strong {
  display: block;
  font-size: 1.05rem;
}

.nav-card-copy > span {
  color: var(--muted);
  font-size: 0.95rem;
}

.post-list {
  display: grid;
  gap: 16px;
}

.post-list h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
}

.post-card {
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.post-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.post-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.entry-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

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

.page-title {
  margin: 0 0 12px;
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  line-height: 1.2;
}

.page-description {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.post-content {
  font-size: 1.125rem;
  line-height: 1.95;
}

.post-content h2 {
  margin-top: 2.75rem;
  margin-bottom: 0.9rem;
  font-size: 1.3rem;
  line-height: 1.35;
  font-weight: 700;
}

.post-content h2:first-child {
  margin-top: 0;
}

.post-content p,
.post-content ul,
.post-content ol {
  margin-top: 0;
  margin-bottom: 1.35rem;
}

.post-content li + li {
  margin-top: 0.4rem;
}

.post-content img {
  display: block;
  width: auto;
  max-width: min(100%, var(--media-max));
  height: auto;
  margin: 1.25rem auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: zoom-in;
}

.post-content img[data-height-capped] {
  width: auto;
  max-width: min(100%, var(--media-max));
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.85);
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  cursor: zoom-out;
}

.post-content blockquote {
  margin: 1rem 0;
  padding: 12px 16px;
  border-left: 3px solid var(--link);
  background: var(--card);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  line-height: 1.5;
}

.post-content :not(pre) > code {
  padding: 0.15em 0.35em;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.page-nav span {
  color: var(--muted);
}

@media (max-width: 900px) {
  .exp-shell {
    grid-template-columns: 1fr;
    gap: 20px;
    width: min(100%, 760px);
    padding: 32px 16px 64px;
  }

  .exp-sidebar {
    position: static;
    max-height: none;
  }

  .exp-header-inner {
    grid-template-columns: auto 1fr auto;
  }
}
