/* ==========================================================================
   T09 Minimal Zen — Ultra-Clean News Template
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  --xxf-primary: #374151;
  --xxf-accent: #6b7280;
  --xxf-surface: #ffffff;
  --xxf-ink: #111827;
  --xxf-muted: #9ca3af;
  --xxf-line: #f3f4f6;
  --xxf-card: #ffffff;
  --xxf-radius: 8px;
  --xxf-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --xxf-max: 960px;

  --font-sans: "Hiragino Sans", "Noto Sans SC", "PingFang SC", system-ui, -apple-system, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-hero: clamp(1.75rem, 1.2rem + 2.5vw, 2.75rem);
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-section: clamp(2.5rem, 2rem + 3vw, 5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --transition: 200ms var(--ease);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--xxf-ink);
  background: var(--xxf-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--xxf-ink);
  text-decoration: none;
  transition: color var(--transition);
}

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

img {
  display: block;
  max-width: 100%;
  height: auto;
}

ul, ol {
  list-style: none;
}

/* ---------- Skip Link ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  background: var(--xxf-ink);
  color: var(--xxf-surface);
  font-size: var(--text-sm);
  border-radius: var(--xxf-radius);
  z-index: 9999;
  transition: top var(--transition);
}

.skip-link:focus {
  top: 0.5rem;
  color: var(--xxf-surface);
}

/* ---------- Layout ---------- */
.xxf-wrap {
  max-width: var(--xxf-max);
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

.layout-two {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: var(--space-lg);
  align-items: start;
}

@media (max-width: 768px) {
  .layout-two {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

/* ---------- SEO Runtime Garbage Cleanup ---------- */
body[class*="template-"] :is(.xxf-wrap,.layout-two,.site-header,.header-inner,.site-nav,.nav-inner,.hero,.hero-card,.hero-layout,.rank-list,.tag-cloud,.cat-grid,.article-list,.article-item,.article-main,.article-body,.article-nav,.sidebar-card,.pagination,.site-footer,.footer-inner,.footer-section,.footer-links,.section-head) > :where(font,ins,small,sup,time,tt,var,area,map,bdo,dfn):not([class]) { display: none !important; }
body[class*="template-"] :is(.site-brand,.header-search,.hero-title,.hero-desc,.hero-media,.item-title,.item-meta,.meta,.more,.footer-copy,.nav-sep) :where(font,ins,small,sup,time,tt,var,area,map,bdo,dfn):not([class]) { display: none !important; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--xxf-line);
}

.header-inner {
  max-width: var(--xxf-max);
  margin: 0 auto;
  padding: var(--space-md) var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.site-brand {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--xxf-ink);
  white-space: nowrap;
}

.site-brand:hover {
  color: var(--xxf-ink);
}

.header-search {
  display: flex;
  align-items: center;
  gap: 0;
}

.header-search input[type="text"] {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--xxf-line);
  border-right: none;
  border-radius: var(--xxf-radius) 0 0 var(--xxf-radius);
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--xxf-ink);
  background: var(--xxf-surface);
  outline: none;
  transition: border-color var(--transition);
  width: 180px;
}

.header-search input[type="text"]:focus {
  border-color: var(--xxf-muted);
}

.header-search button {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--xxf-line);
  border-left: none;
  border-radius: 0 var(--xxf-radius) var(--xxf-radius) 0;
  background: var(--xxf-surface);
  color: var(--xxf-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.header-search button:hover {
  background: var(--xxf-ink);
  color: var(--xxf-surface);
  border-color: var(--xxf-ink);
}

/* ---------- Nav ---------- */
.site-nav {
  border-bottom: 1px solid var(--xxf-line);
}

.nav-inner {
  max-width: var(--xxf-max);
  margin: 0 auto;
  padding: 0 var(--space-sm);
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-inner a {
  display: inline-block;
  padding: 0.65rem 1rem;
  font-size: var(--text-sm);
  color: var(--xxf-muted);
  white-space: nowrap;
  transition: color var(--transition);
  position: relative;
}

.nav-inner a:hover,
.nav-inner a[aria-current="page"] {
  color: var(--xxf-ink);
}

.nav-inner a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: var(--xxf-ink);
  transform: scaleX(0);
  transition: transform var(--transition);
}

.nav-inner a:hover::after,
.nav-inner a[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav-sep {
  display: inline-block;
  width: 1px;
  height: 14px;
  background: var(--xxf-line);
  vertical-align: middle;
  margin: 0 0.25rem;
}

/* ---------- Section Head ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--xxf-line);
}

.section-head h2 {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--xxf-muted);
}

.section-head .more {
  font-size: var(--text-xs);
  color: var(--xxf-muted);
}

.section-head .more:hover {
  color: var(--xxf-ink);
}

/* ---------- Hero ---------- */
.hero {
  padding: var(--space-xl) 0;
}

.hero-card {
  margin-bottom: var(--space-lg);
}

.hero-card .hero-media {
  display: block;
  margin-bottom: var(--space-md);
  border-radius: var(--xxf-radius);
  overflow: hidden;
}

.hero-card .hero-media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: opacity var(--transition);
}

.hero-card .hero-media:hover img {
  opacity: 0.9;
}

.hero-card .hero-title {
  font-size: var(--text-hero);
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-xs);
}

.hero-card .hero-title a:hover {
  color: var(--xxf-accent);
}

.hero-card .hero-desc {
  font-size: var(--text-base);
  color: var(--xxf-muted);
  line-height: 1.8;
  max-width: 640px;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-lg);
  align-items: start;
}

@media (max-width: 768px) {
  .hero-layout {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

/* ---------- Rank List ---------- */
.rank-list {
  counter-reset: rank;
}

.rank-list li {
  counter-increment: rank;
  padding: 0.45rem 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--xxf-line);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.rank-list li::before {
  content: counter(rank);
  font-size: var(--text-xs);
  color: var(--xxf-muted);
  min-width: 1.2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.rank-list li:last-child {
  border-bottom: none;
}

.rank-list a {
  color: var(--xxf-ink);
  line-height: 1.5;
}

.rank-list a:hover {
  color: var(--xxf-accent);
}

/* ---------- Tag Cloud ---------- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-cloud a {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: var(--text-xs);
  color: var(--xxf-muted);
  border: 1px solid var(--xxf-line);
  border-radius: 999px;
  transition: all var(--transition);
}

.tag-cloud a:hover {
  color: var(--xxf-ink);
  border-color: var(--xxf-muted);
}

/* ---------- Category Grid ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xs);
}

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

.cat-grid a {
  display: block;
  padding: 0.6rem 0.75rem;
  font-size: var(--text-sm);
  color: var(--xxf-ink);
  border: 1px solid var(--xxf-line);
  border-radius: var(--xxf-radius);
  text-align: center;
  transition: all var(--transition);
}

.cat-grid a:hover {
  border-color: var(--xxf-muted);
  color: var(--xxf-accent);
}

/* ---------- Article List ---------- */
.article-list {
  display: grid;
  gap: 0;
}

.article-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--xxf-line);
  transition: background var(--transition);
}

.article-item:first-child {
  padding-top: 0;
}

.article-item:last-child {
  border-bottom: none;
}

.article-item:hover {
  background: var(--xxf-line);
  margin: 0 calc(var(--space-sm) * -1);
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
  border-radius: var(--xxf-radius);
}

.article-item .item-title {
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: 0.15rem;
}

.article-item .item-title a:hover {
  color: var(--xxf-accent);
}

.article-item .item-meta {
  font-size: var(--text-xs);
  color: var(--xxf-muted);
}

/* ---------- Article Body (Show) ---------- */
.article-main {
  min-width: 0;
}

.article-main .article-title {
  font-size: var(--text-2xl);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-sm);
}

.article-main .meta {
  display: flex;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--xxf-muted);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--xxf-line);
}

.article-body {
  font-size: var(--text-base);
  line-height: 2;
  color: var(--xxf-ink);
}

.article-body p {
  margin-bottom: var(--space-sm);
}

.article-body img {
  border-radius: var(--xxf-radius);
  margin: var(--space-md) 0;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  font-weight: 600;
  margin: var(--space-md) 0 var(--space-sm);
  line-height: 1.4;
}

.article-body ul,
.article-body ol {
  padding-left: 1.5em;
  margin-bottom: var(--space-sm);
}

.article-body ul {
  list-style: disc;
}

.article-body ol {
  list-style: decimal;
}

.article-body li {
  margin-bottom: 0.25rem;
}

.article-body blockquote {
  border-left: 2px solid var(--xxf-line);
  padding-left: var(--space-md);
  margin: var(--space-md) 0;
  color: var(--xxf-muted);
  font-style: italic;
}

.article-body a {
  color: var(--xxf-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-body a:hover {
  color: var(--xxf-ink);
}

/* ---------- Article Nav ---------- */
.article-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--xxf-line);
}

.article-nav a {
  font-size: var(--text-sm);
  color: var(--xxf-muted);
  line-height: 1.6;
  transition: color var(--transition);
}

.article-nav a:hover {
  color: var(--xxf-ink);
}

/* ---------- Sidebar ---------- */
.sidebar-card {
  position: sticky;
  top: var(--space-md);
}

.sidebar-card .section-head {
  margin-top: var(--space-md);
}

.sidebar-card .section-head:first-child {
  margin-top: 0;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: var(--space-md) 0;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: var(--text-sm);
  border: 1px solid var(--xxf-line);
  border-radius: var(--xxf-radius);
  color: var(--xxf-ink);
  transition: all var(--transition);
}

.pagination a:hover {
  border-color: var(--xxf-muted);
  background: var(--xxf-line);
}

.pagination .current {
  background: var(--xxf-ink);
  color: var(--xxf-surface);
  border-color: var(--xxf-ink);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--space-xl);
  border-top: 1px solid var(--xxf-line);
  padding: var(--space-lg) 0;
}

.footer-inner {
  max-width: var(--xxf-max);
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

.footer-section {
  margin-bottom: var(--space-md);
}

.footer-section h3 {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--xxf-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.footer-links a {
  font-size: var(--text-xs);
  color: var(--xxf-muted);
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--xxf-ink);
}

.footer-copy {
  padding-top: var(--space-sm);
  border-top: 1px solid var(--xxf-line);
  font-size: var(--text-xs);
  color: var(--xxf-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.footer-copy a {
  color: var(--xxf-muted);
}

.footer-copy a:hover {
  color: var(--xxf-ink);
}

/* ---------- Index Sections ---------- */
.index-rank {
  padding-bottom: var(--space-lg);
}

.index-keywords {
  padding-bottom: var(--space-lg);
}

.index-categories {
  padding-bottom: var(--space-lg);
}

.index-articles {
  padding-bottom: var(--space-lg);
}

/* ---------- Section Divider ---------- */
.section-divider {
  border: none;
  border-top: 1px solid var(--xxf-line);
  margin: var(--space-md) 0;
}

/* ---------- Responsive Fine-Tuning ---------- */
@media (max-width: 480px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .header-search input[type="text"] {
    width: 100%;
  }

  .hero-card .hero-title {
    font-size: clamp(1.5rem, 1.1rem + 2vw, 2rem);
  }

  .cat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .article-item:hover {
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }
}

/* ---------- Utility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-muted {
  color: var(--xxf-muted);
}
