/* sxue.xyz — tokens aligned with warm orange logo; neutrals for readable long-form */

:root {
  /* --color-accent: sampled from logo (public/assets/logo.png), orange pixels avg */
  --color-bg: #faf8f6;
  --color-surface: #ffffff;
  --color-text: #1c1917;
  --color-muted: #57534e;
  --color-border: #e7e5e4;
  --color-accent: #fc6a0e;
  --color-accent-hover: #ce560b;
  --color-accent-soft: rgba(252, 106, 14, 0.1);
  --color-accent-glow: rgba(252, 106, 14, 0.14);
  --font-sans: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Georgia", "Songti SC", "SimSun", serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 4px 12px rgba(28, 25, 23, 0.06);
  --shadow-hover: 0 4px 16px rgba(252, 106, 14, 0.12);
  --max-content: 72rem;
  --prose-width: 42rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: #fff;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

.site-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 rgba(28, 25, 23, 0.04);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header__inner {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  max-width: min(42rem, 100%);
  flex: 0 0 auto;
}

.site-brand:hover {
  text-decoration: none;
  color: var(--color-accent);
}

.site-brand__logo,
.site-brand img {
  display: block;
  height: 3rem;
  width: auto;
  min-width: 6rem;
  max-width: min(16rem, 88vw);
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
}

.nav-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: min(12rem, 100%);
}

.nav-primary a {
  display: inline-block;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-primary a:hover {
  background: var(--color-accent-soft);
  text-decoration: none;
  color: var(--color-accent-hover);
}

.nav-primary a[aria-current="page"] {
  background: var(--color-accent-soft);
  color: var(--color-accent-hover);
  font-weight: 600;
}

.layout-main {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.hero {
  background: linear-gradient(135deg, #b8470a 0%, #fc6a0e 45%, #fda14d 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
}

.hero p {
  margin: 0;
  opacity: 0.92;
  font-size: 0.95rem;
  max-width: 44rem;
  line-height: 1.65;
}

.hero--category {
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
}

.hero--category h1 {
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  margin-bottom: 0.35rem;
}

.hero-stat {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  opacity: 0.75;
}

.section-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.channel-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  color: inherit;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.channel-card:hover {
  border-color: rgba(252, 106, 14, 0.35);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
  color: var(--color-accent-hover);
}

.channel-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.channel-card small {
  color: var(--color-muted);
  font-size: 0.8rem;
}

.article-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.article-list li {
  border-bottom: 1px solid var(--color-border);
}

.article-list li:last-child {
  border-bottom: 0;
}

.article-list a {
  display: block;
  padding: 1rem 1.1rem;
  color: inherit;
}

.article-list a:hover {
  background: var(--color-accent-soft);
  text-decoration: none;
}

.article-list .meta {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 0.35rem;
}

.article-list .excerpt {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-top: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  color: var(--color-border);
  pointer-events: none;
}

/* Category page */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
}

.page-header .lede {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.card-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .card-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .card-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.article-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  color: inherit;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s, border-left-color 0.15s, transform 0.15s;
}

.article-card:hover {
  border-color: rgba(252, 106, 14, 0.3);
  border-left-color: var(--color-accent);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
  transform: translateY(-2px);
}

.article-card .card-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  align-self: flex-start;
}

.article-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
}

.article-card .meta {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: auto;
  padding-top: 0.5rem;
}

.article-card .excerpt {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2rem;
  align-items: center;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.875rem;
  color: var(--color-text);
}

.pagination a:hover {
  border-color: var(--color-accent);
  text-decoration: none;
  color: var(--color-accent);
}

.pagination .current {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px var(--color-accent-glow);
}

.pagination .pagination-ellipsis {
  min-width: auto;
  padding: 0 0.35rem;
  border: none;
  background: transparent;
  color: var(--color-muted);
  cursor: default;
}

/* Article layout: main + sidebar on desktop */
.article-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .article-layout {
    flex-direction: row;
    align-items: flex-start;
  }
  .article-article {
    flex: 1 1 0;
    min-width: 0;
  }
  .article-sidebar {
    flex: 0 0 18rem;
    position: sticky;
    top: 5rem;
  }
}

.article-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}

.sidebar-box h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-accent);
}

.sidebar-box ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-box li {
  border-bottom: 1px solid var(--color-border);
}

.sidebar-box li:last-child {
  border-bottom: 0;
}

.sidebar-box a {
  display: block;
  padding: 0.45rem 0;
  color: var(--color-text);
  font-size: 0.875rem;
  line-height: 1.45;
}

.sidebar-box a:hover {
  color: var(--color-accent);
}

.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sidebar-tags a {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  transition: border-color 0.15s, color 0.15s;
}

.sidebar-tags a:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

/* Inline related (horizontal list for category page) */
.related-inline {
  margin-top: 2rem;
  padding: 1rem 1.15rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
}

.related-inline strong {
  font-size: 0.9rem;
  color: var(--color-text);
  margin-right: 0.25rem;
}

.related-inline a {
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  background: var(--color-accent-soft);
  border-radius: 4px;
  color: var(--color-accent-hover);
}

.related-inline a:hover {
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
}

.article-article {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem 2rem;
  box-shadow: var(--shadow);
}

@media (min-width: 640px) {
  .article-article {
    padding: 2rem 2.25rem 2.5rem;
  }
}

.article-article header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.article-article .label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.article-article h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
  line-height: 1.35;
  font-weight: 700;
}

.article-meta {
  font-size: 0.875rem;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.prose {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--color-text);
  max-width: var(--prose-width);
}

.prose h2 {
  margin: 1.75rem 0 0.65rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.prose h3 {
  margin: 1.35rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.prose p {
  margin: 0 0 1rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose strong {
  font-weight: 600;
}

/* legacy .related kept for backward compat */
.related {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.related h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
}

.related ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.related a {
  display: block;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
  color: inherit;
}

.related a:hover {
  color: var(--color-accent);
}

.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: 2rem;
  padding: 2rem 1.25rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.site-footer__inner {
  max-width: var(--max-content);
  margin: 0 auto;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.site-footer nav a {
  color: var(--color-muted);
}

.site-footer nav a:hover {
  color: var(--color-accent);
}

.site-footer .legal {
  margin: 0;
  line-height: 1.6;
}

.prototype-note {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #7c2d12;
  margin-bottom: 1.25rem;
}

/* ——— Hamburger toggle (CSS-only checkbox hack) ——— */
.nav-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.nav-toggle-label {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  margin-left: auto;
  border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle-label:hover {
  background: var(--color-accent-soft);
}

.nav-toggle-label span {
  display: block;
  position: relative;
  width: 1.25rem;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: background 0.2s;
}

.nav-toggle-label span::before,
.nav-toggle-label span::after {
  content: '';
  display: block;
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s, top 0.2s;
}

.nav-toggle-label span::before { top: -6px; }
.nav-toggle-label span::after { top: 6px; }

.nav-toggle:checked + .nav-toggle-label span {
  background: transparent;
}

.nav-toggle:checked + .nav-toggle-label span::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle:checked + .nav-toggle-label span::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ——— Friend links (footer) ——— */
.footer-friendlinks {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--color-border);
}

.footer-friendlinks h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.footer-friendlinks ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

.footer-friendlinks a {
  color: var(--color-muted);
  font-size: 0.8rem;
}

.footer-friendlinks a:hover {
  color: var(--color-accent);
}

/* ——— Responsive — compact phone ——— */
@media (max-width: 479.98px) {
  .site-header__inner {
    padding: 0.5rem 0.75rem;
  }
  .layout-main {
    padding: 1rem 0.75rem 2rem;
  }
  .hero {
    padding: 1.25rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-sm);
  }
  .channel-card {
    padding: 0.75rem;
  }
  .article-article {
    padding: 1rem 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
  }
  .pagination a,
  .pagination span {
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.45rem;
    font-size: 0.8rem;
  }
}

/* ——— Responsive — mobile (hamburger, stacked nav, footer grid, touch targets) ——— */
@media (max-width: 767.98px) {
  .nav-toggle-label {
    display: flex;
  }
  .nav-primary {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0 0;
    order: 3;
  }
  .nav-toggle:checked ~ .nav-primary {
    display: flex;
  }
  .nav-primary a {
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
  }
  .article-list a {
    min-height: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .site-footer nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem 1rem;
  }
}

/* ——— Responsive — tablet ——— */
@media (min-width: 768px) {
  .channel-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ——— Responsive — desktop ——— */
@media (min-width: 1024px) {
  .channel-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
