/* Homepage — left cate tabs + middle codelist + right aside (runoob) */
.rn-home {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 10px 32px;
  max-width: var(--rn-content-max);
  margin: 0 auto;
  overflow: visible;
}

.rn-home--no-aside {
  /* still keep left + middle */
}

.rn-home--no-left .rn-home__cates {
  display: none;
}

/* ---- Left category tabs ---- */
.rn-home__cates {
  width: var(--rn-home-left);
  flex-shrink: 0;
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  scrollbar-width: none;
  /* Must stay below sticky nav (200) */
  z-index: 1;
}

.rn-home__cates::-webkit-scrollbar {
  display: none;
}

.rn-cate-head {
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 11px 14px;
  border-radius: 8px 8px 0 0;
  background: var(--rn-primary);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rn-cate-list {
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--rn-primary-border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 16px rgba(60, 90, 40, 0.08);
}

.rn-cate-list button,
.rn-cate-list a {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-weight: 500;
  font-size: 13px;
  padding: 12px;
  cursor: pointer;
  color: var(--rn-text);
  text-align: left;
  text-decoration: none;
  border-left: 3px solid transparent;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.rn-cate-list button:hover,
.rn-cate-list a:hover {
  background: var(--rn-primary-soft-2);
  border-left-color: #80b858;
  color: #2e5a18;
  font-weight: 600;
}

.rn-cate-list button.is-active,
.rn-cate-list a.is-active {
  background: var(--rn-primary-soft);
  border-left-color: var(--rn-tab-active);
  color: #2e5a18;
  font-weight: 700;
}

.rn-cate-list .rn-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rn-primary);
  opacity: 0.4;
  flex-shrink: 0;
}

/* ---- Middle column ---- */
.rn-home__main {
  flex: 1;
  min-width: 0;
}

.rn-tab-panel {
  display: none;
}

.rn-tab-panel.is-active {
  display: block;
}

/* Codelist group — white card with grid */
.rn-codelist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  align-items: stretch;
  background: #fff;
  border-radius: var(--rn-radius-lg);
  margin-bottom: 18px;
  padding: 0 16px 16px;
  box-shadow: var(--rn-shadow-card);
  overflow: hidden;
  animation: rnFadeUp 0.28s ease both;
}

.rn-codelist__title {
  grid-column: 1 / -1;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 12px 2px 11px;
  margin: 0;
  border-bottom: 1px solid var(--rn-border-green);
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--rn-text);
}

.rn-codelist__title::before {
  content: "";
  width: 4px;
  height: 14px;
  background: var(--rn-primary);
  border-radius: 1px;
  flex-shrink: 0;
}

.rn-codelist__more {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--rn-text-muted);
  text-decoration: none;
}

.rn-codelist__more:hover {
  color: var(--rn-primary-dark);
}

/* Tutorial cards inside codelist */
.rn-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  text-decoration: none;
  color: #222;
  min-height: 68px;
  border-radius: 6px;
  background: #f7f9f4;
  transition: background 0.15s, box-shadow 0.15s;
}

.rn-item:hover {
  background: #f4f9ee;
  box-shadow: inset 0 0 0 1px #cde0b0;
  z-index: 1;
  text-decoration: none;
  color: #222;
}

.rn-item__icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: contain;
  background: #f5f8f0;
  padding: 3px;
  display: block;
}

.rn-item__icon--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--rn-primary-dark);
  background: var(--rn-primary-soft);
}

.rn-item__body {
  flex: 1;
  min-width: 0;
}

.rn-item__title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #2a4e18;
  margin: 0 0 4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rn-item:hover .rn-item__title {
  color: var(--rn-primary-hover);
}

.rn-item__desc {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--rn-text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---- Right aside widgets ---- */
.rn-home__aside {
  width: var(--rn-aside-width);
  flex-shrink: 0;
}

.rn-widget {
  background: var(--rn-bg-light);
  margin: 0 0 16px;
  padding: 0;
  box-shadow: var(--rn-shadow-sm);
  border-radius: var(--rn-radius);
  overflow: hidden;
}

.rn-widget__title {
  margin: 0;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 800;
  color: #525252;
  background: var(--rn-bg-widget-head);
  border: 1px solid #d6d6d6;
  border-bottom: 1px solid var(--rn-border);
  line-height: 18px;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

.rn-widget__body {
  padding: 10px 12px 14px;
  background: #fff;
  border: 1px solid #d6d6d6;
  border-top: 0;
}

.rn-widget__body::after {
  content: "";
  display: table;
  clear: both;
}

.rn-widget__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.rn-widget__list li {
  float: left;
  width: 48%;
  margin: 0 2% 6px 0;
}

.rn-widget__list li:nth-child(2n) {
  margin-right: 0;
}

.rn-widget__list a {
  display: block;
  color: #999;
  background-color: #f6f6f6;
  font-size: 12px;
  height: 29px;
  line-height: 29px;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  text-align: center;
  border-radius: 2px;
}

.rn-widget__list a:hover {
  color: var(--rn-primary-dark);
  background: var(--rn-primary-soft);
}

.rn-widget__list--stack li {
  float: none;
  width: 100%;
  margin: 0 0 6px;
}

.rn-widget__list--stack a {
  text-align: left;
}

.rn-widget__list--stack a::before {
  content: "· ";
  color: var(--rn-primary);
  font-weight: 700;
}

.rn-widget__qr {
  text-align: center;
  padding: 12px;
  background: #fff;
  border: 1px solid #d6d6d6;
  border-top: 0;
}

.rn-widget__qr img {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.rn-widget__qr p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--rn-text-muted);
}

.rn-ad {
  margin-bottom: 16px;
}

@keyframes rnFadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
