/*
Theme Name: Yoritanomu
Theme URI: https://github.com/lunasysdavid/yoritanomu
Author: Lunasys
Description: Lightweight doctrinal-blog theme with responsive mobile-first layout, category chips, and sidebar category list.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
Text Domain: yoritanomu
*/

/* ── Tokens ─────────────────────────────────────────── */
:root {
  --bg:          #ffffff;
  --bg-soft:     #f8f8f6;
  --bg-alt:      #f2f1ee;
  --text:        #111110;
  --text-2:      #5a5a58;
  --text-3:      #999896;
  --primary:     #1a56db;
  --primary-h:   #1444b8;
  --accent:      #e05c2a;
  --border:      #e8e7e4;
  --border-soft: #f0efec;
  --radius-sm:   3px;
  --radius:      8px;
  --max-w:       1100px;
  --sans:        "Inter", system-ui, -apple-system, sans-serif;
  --display:     "Space Grotesk", system-ui, sans-serif;
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }
ul, ol { padding-left: 1.4em; }

/* ── Layout ──────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-main {
  padding: 3rem 0 4rem;
}

@media (max-width: 600px) {
  .site-main { padding: 2rem 0 3rem; }
}

/* ── Header ──────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 60px;
}

.site-title {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.site-title a { color: inherit; }
.site-title a:hover { color: var(--primary); }

.site-description { display: none; }

.site-nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  font-size: 0.875rem;
  color: var(--text-2);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color .15s;
}

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

.site-header__right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-search {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-soft);
  transition: border-color .15s;
}

.header-search:focus-within {
  border-color: var(--primary);
  background: var(--bg);
}

.header-search input[type="search"] {
  border: none;
  background: transparent;
  padding: 0.35em 0.75em;
  font-size: 0.8125rem;
  font-family: var(--sans);
  color: var(--text);
  outline: none;
  width: 160px;
}

.header-search input[type="search"]::placeholder { color: var(--text-3); }

.header-search button {
  border: none;
  background: transparent;
  padding: 0 0.65rem 0 0.25rem;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color .15s;
}

.header-search button:hover { color: var(--primary); }

@media (max-width: 520px) {
  .header-search input[type="search"] { width: 110px; }
}

/* ── Footer ──────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-size: 0.8125rem;
  color: var(--text-3);
  text-align: center;
}

.site-footer a { color: var(--text-3); }
.site-footer a:hover { color: var(--text-2); }

/* ── Site intro ──────────────────────────────────────── */
.site-intro {
  max-width: 640px;
  margin: 0 auto 4rem;
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.site-intro p {
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 2;
  margin: 0;
}

/* ── Category sections ───────────────────────────────── */
.cat-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0 3rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
}

.cat-section:last-of-type { border-bottom: 1px solid var(--border); }

@media (max-width: 680px) {
  .cat-section { grid-template-columns: 1fr; gap: 1rem; }
}

.cat-section__label {
  padding-top: 0.2rem;
}

.cat-section__title {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.cat-section__title a { color: var(--text); }
.cat-section__title a:hover { color: var(--primary); }

.cat-section__count {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-3);
  font-family: var(--sans);
}

/* ── Post list (homepage) ────────────────────────────── */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.post-list__item:first-child { padding-top: 0; }
.post-list__item:last-child { border-bottom: none; }

.post-list__link {
  font-size: 0.9375rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
  transition: color .15s;
  flex: 1;
}

.post-list__link:hover { color: var(--primary); }

.post-list__date {
  font-size: 0.75rem;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--sans);
  letter-spacing: 0.02em;
}

/* ── Post grid (archive/search pages) ───────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  list-style: none;
  padding: 0;
}

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

@media (max-width: 520px) {
  .posts-grid { grid-template-columns: 1fr; }
}

.post-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, border-color .2s;
}

.post-card:hover {
  border-color: #d0cfcb;
  box-shadow: 0 4px 16px rgba(0,0,0,.07);
}

.post-card__cats { margin-bottom: 0.6rem; }

.post-card__title {
  font-family: var(--display);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.post-card__title a { color: var(--text); }
.post-card__title a:hover { color: var(--primary); }

.post-card__meta {
  font-size: 0.8125rem;
  color: var(--text-3);
  margin-bottom: 0.75rem;
}

.post-card__excerpt {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.65;
  flex: 1;
}

.read-more {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: 0.01em;
}

.read-more:hover { color: var(--primary-h); }

/* ── Category chips ──────────────────────────────────── */
.cat-chip {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  background: #eff4ff;
  padding: 0.2em 0.6em;
  border-radius: var(--radius-sm);
  margin-right: 0.3em;
}

.cat-chip:hover { background: #dce8ff; color: var(--primary-h); }

.cat-chip--tag {
  background: #fff3ee;
  color: var(--accent);
}

.cat-chip--tag:hover { background: #ffe5d9; }

/* ── Single post ─────────────────────────────────────── */
.post-single { max-width: 720px; margin: 0 auto; }

.post-single__header { margin-bottom: 2.5rem; }

.post-single__title {
  font-family: var(--display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0.5rem 0 0.75rem;
}

.post-single__meta {
  font-size: 0.8125rem;
  color: var(--text-3);
}

.post-single__content {
  font-family: var(--display);
  font-size: 1.0625rem;
  line-height: 1.85;
  color: #2a2a28;
}

.post-single__content p { margin-bottom: 1.4em; }

.post-single__content h2 {
  font-family: var(--sans);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2.5em 0 0.75em;
  color: var(--text);
}

.post-single__content h3 {
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 2em 0 0.5em;
  color: var(--text);
}

.post-single__content blockquote {
  border-left: 3px solid var(--border);
  padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 1.75em 0;
  color: var(--text-2);
  font-style: italic;
}

.post-single__content a { text-decoration: underline; text-underline-offset: 3px; }

.post-single__content ul,
.post-single__content ol { margin-bottom: 1.4em; }

.post-single__footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

/* ── Archive header ──────────────────────────────────── */
.archive-header { margin-bottom: 2rem; }

.archive-header__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.35rem;
}

.archive-header__title {
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.archive-header__description {
  margin-top: 0.5rem;
  color: var(--text-2);
  font-size: 0.9375rem;
}

/* ── Page ────────────────────────────────────────────── */
.page-single__title {
  font-family: var(--display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

/* ── Search form ─────────────────────────────────────── */
.search-form {
  display: flex;
  gap: 0.5rem;
}

.search-form input[type="search"] {
  flex: 1;
  padding: 0.5em 0.75em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--sans);
  background: var(--bg-soft);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}

.search-form input[type="search"]:focus { border-color: var(--primary); background: var(--bg); }

.search-form button {
  padding: 0.5em 1em;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: var(--sans);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}

.search-form button:hover { background: var(--primary-h); }

/* ── Pagination ──────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 0.375rem;
  padding: 2.5rem 0 0;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition: all .15s;
}

.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .dots { border: none; }

/* ── 404 / search header ─────────────────────────────── */
.not-found,
.search-results-header { margin-bottom: 2rem; }

.not-found__title,
.search-results-header__title {
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.no-results { color: var(--text-2); }

/* ── Utility ─────────────────────────────────────────── */
.screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
