/*
Theme Name: XS Blog
Theme URI: https://example.com/xs-blog
Author: x-search / Codex Orchestrator
Description: Code-managed block theme for a clean, readable technical blog. Built to replace heavy classic themes with theme.json, templates, parts, and patterns.
Version: 0.1.1
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 8.1
Text Domain: xs-blog
*/

:root {
  --xs-font-sans: "Inter", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --xs-font-serif: "Newsreader", "Noto Serif JP", Georgia, serif;
  --xs-color-ink: #17181c;
  --xs-color-muted: #626875;
  --xs-color-paper: #fbfaf7;
  --xs-color-surface: #ffffff;
  --xs-color-line: #dedbd2;
  --xs-color-accent: #0f766e;
  --xs-color-accent-strong: #115e59;
  --xs-color-code: #f2f7f6;
  --xs-radius: 8px;
  --xs-shadow-soft: 0 20px 45px rgba(23, 24, 28, 0.08);
}

body {
  background: var(--xs-color-paper);
  color: var(--xs-color-ink);
  font-family: var(--xs-font-sans);
  letter-spacing: 0;
}

a {
  color: var(--xs-color-accent-strong);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.wp-site-blocks {
  min-height: 100vh;
}

.xs-container {
  margin-inline: auto;
  max-width: 1120px;
  padding-inline: clamp(18px, 4vw, 40px);
}

.xs-card {
  background: var(--xs-color-surface);
  border: 1px solid var(--xs-color-line);
  border-radius: var(--xs-radius);
  box-shadow: var(--xs-shadow-soft);
}

.xs-meta {
  color: var(--xs-color-muted);
  font-size: 0.9rem;
}

.xs-eyebrow {
  color: var(--xs-color-accent-strong);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.xs-article-shell {
  background: var(--xs-color-surface);
  border: 1px solid var(--xs-color-line);
  border-radius: var(--xs-radius);
  margin-block: clamp(24px, 5vw, 56px);
  padding: clamp(24px, 5vw, 64px);
}

.xs-article-shell :where(h1, h2, h3) {
  letter-spacing: 0;
}

.xs-article-shell :where(p, li) {
  line-height: 1.9;
}

.xs-article-shell pre,
.xs-article-shell code {
  background: var(--xs-color-code);
  border-radius: 6px;
}

.xs-article-shell pre {
  overflow-x: auto;
  padding: 1rem;
}

.xs-site-header {
  backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--xs-color-paper) 86%, transparent);
  border-bottom: 1px solid var(--xs-color-line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.xs-site-footer {
  border-top: 1px solid var(--xs-color-line);
  color: var(--xs-color-muted);
  margin-top: clamp(48px, 8vw, 96px);
}

@media (max-width: 720px) {
  .xs-article-shell {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    margin-inline: calc(clamp(18px, 4vw, 40px) * -1);
  }
}

/* Production refinements */
.wp-site-blocks {
  overflow-x: clip;
}

.xs-site-header .xs-container,
.xs-site-footer .xs-container {
  gap: 16px 28px;
}

.wp-block-site-title a {
  text-decoration: none;
}

.xs-site-header .wp-block-navigation {
  font-size: 0.94rem;
}

.xs-site-header .wp-block-navigation__responsive-container-open,
.xs-site-header .wp-block-navigation__responsive-container-close {
  border: 1px solid var(--xs-color-line);
  border-radius: 999px;
  padding: 8px;
}

.xs-home-hero {
  border-bottom: 1px solid var(--xs-color-line);
  margin-bottom: clamp(24px, 5vw, 48px);
}

.xs-section-title {
  margin-bottom: 1rem;
}

.xs-post-grid {
  gap: clamp(18px, 3vw, 28px) !important;
}

.xs-card {
  overflow: hidden;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.xs-card:hover {
  border-color: color-mix(in srgb, var(--xs-color-accent) 45%, var(--xs-color-line));
  box-shadow: 0 22px 52px rgba(23, 24, 28, 0.11);
  transform: translateY(-2px);
}

.xs-card .wp-block-post-featured-image {
  margin: calc(var(--wp--preset--spacing--50) * -1) calc(var(--wp--preset--spacing--50) * -1) var(--wp--preset--spacing--40);
}

.xs-card .wp-block-post-featured-image img {
  aspect-ratio: 16 / 9;
  display: block;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.xs-card .wp-block-post-title {
  line-height: 1.35;
  margin-top: 0.6rem;
}

.xs-card .wp-block-post-title a {
  color: var(--xs-color-ink);
  text-decoration: none;
}

.xs-card .wp-block-post-title a:hover {
  color: var(--xs-color-accent-strong);
}

.xs-card .wp-block-post-excerpt__excerpt {
  color: var(--xs-color-muted);
  line-height: 1.75;
}

.wp-block-post-excerpt__more-link,
.wp-block-query-pagination a,
.wp-block-search__button {
  background: var(--xs-color-accent-strong);
  border: 0;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  padding: 0.55rem 0.9rem;
  text-decoration: none;
}

.wp-block-search__inside-wrapper {
  border: 1px solid var(--xs-color-line);
  border-radius: 999px;
  overflow: hidden;
}

.wp-block-search__input {
  border: 0;
  min-height: 44px;
  padding-inline: 1rem;
}

.xs-breadcrumbs {
  color: var(--xs-color-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.86rem;
  gap: 0.45rem;
  margin-block: clamp(20px, 4vw, 36px) -12px;
}

.xs-breadcrumbs a {
  color: var(--xs-color-muted);
  text-decoration: none;
}

.xs-breadcrumbs span:last-child {
  color: var(--xs-color-ink);
}

.xs-share,
.xs-author-box,
.xs-related {
  border-top: 1px solid var(--xs-color-line);
  margin-top: clamp(28px, 5vw, 48px);
  padding-top: clamp(22px, 4vw, 34px);
}

.xs-share__title,
.xs-author-box__label {
  color: var(--xs-color-muted);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
}

.xs-share__links,
.xs-related__grid {
  display: grid;
  gap: 12px;
}

.xs-share__links {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.xs-share__links a {
  border: 1px solid var(--xs-color-line);
  border-radius: 999px;
  color: var(--xs-color-ink);
  font-weight: 700;
  padding: 0.65rem 0.8rem;
  text-align: center;
  text-decoration: none;
}

.xs-author-box {
  align-items: flex-start;
  display: flex;
  gap: 16px;
}

.xs-author-box__avatar {
  border-radius: 50%;
  flex: 0 0 auto;
}

.xs-author-box__name {
  font-weight: 800;
  margin: 0;
}

.xs-author-box__description {
  color: var(--xs-color-muted);
  line-height: 1.75;
  margin-bottom: 0;
}

.xs-related__grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.xs-related h2 {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
}

.xs-related__card {
  border: 1px solid var(--xs-color-line);
  border-radius: var(--xs-radius);
  overflow: hidden;
}

.xs-related__image img {
  aspect-ratio: 16 / 9;
  display: block;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.xs-related__body {
  padding: 14px;
}

.xs-related__body h3 {
  font-size: 1rem;
  line-height: 1.45;
  margin: 0.35rem 0 0;
}

.xs-related__body h3 a {
  color: var(--xs-color-ink);
  text-decoration: none;
}

.xs-site-footer a {
  color: inherit;
}

@media (max-width: 860px) {
  .xs-related__grid,
  .xs-share__links {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .xs-site-header {
    position: static;
  }

  .xs-site-header .xs-container,
  .xs-site-footer .xs-container {
    align-items: flex-start;
    flex-direction: column;
  }

  .xs-card .wp-block-post-featured-image {
    margin-left: calc(var(--wp--preset--spacing--40) * -1);
    margin-right: calc(var(--wp--preset--spacing--40) * -1);
  }
}

/* Live-site hardening: override WordPress block defaults that caused layout drift. */
.xs-container {
  box-sizing: border-box;
  width: 100%;
}

main.xs-container {
  padding-block: clamp(18px, 3vw, 32px) clamp(36px, 6vw, 72px);
}

.xs-home-hero {
  max-width: 100% !important;
}

.xs-home-hero h1 {
  font-size: clamp(2rem, 5vw, 4rem) !important;
  line-height: 1.16;
  max-width: 12em;
}

.xs-home-hero .wp-block-search {
  max-width: 560px;
}

.wp-block-post-template.xs-post-grid {
  display: grid !important;
  gap: clamp(18px, 3vw, 28px) !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wp-block-post-template.xs-post-grid > li {
  min-width: 0;
}

.wp-block-post-template.xs-post-grid .xs-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.xs-card .wp-block-post-featured-image {
  background: var(--xs-color-code);
  line-height: 0;
}

.xs-card .wp-block-post-featured-image a,
.xs-card .wp-block-post-featured-image img {
  display: block;
  height: 100% !important;
  width: 100% !important;
}

.xs-card .wp-block-post-title.has-x-large-font-size {
  font-size: clamp(1.15rem, 1.9vw, 1.55rem) !important;
}

.xs-card .wp-block-post-excerpt {
  flex: 1;
}

.xs-card .wp-block-post-excerpt__more-text {
  margin-bottom: 0;
}

.xs-article-shell {
  box-sizing: border-box;
  max-width: 880px !important;
  width: 100%;
}

.xs-article-shell .wp-block-post-title {
  font-size: clamp(1.9rem, 4.4vw, 3rem) !important;
  line-height: 1.22;
}

.xs-article-shell > .wp-block-post-featured-image {
  line-height: 0;
  margin-block: clamp(18px, 4vw, 32px);
}

.xs-article-shell > .wp-block-post-featured-image img {
  display: block;
  height: auto !important;
  max-height: 520px;
  object-fit: cover;
  width: 100% !important;
}

.xs-article-shell .entry-content {
  max-width: 720px;
}

.xs-article-shell .entry-content :where(img, video, iframe) {
  height: auto;
  max-width: 100%;
}

.xs-article-shell .entry-content .wp-block-image {
  margin-block: clamp(20px, 4vw, 36px);
}

.xs-article-shell .entry-content .wp-block-image img {
  border-radius: var(--xs-radius);
  display: block;
  margin-inline: auto;
}

.xs-article-shell .entry-content .wp-block-gallery {
  display: grid !important;
  gap: 12px !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.xs-article-shell .entry-content .wp-block-gallery .wp-block-image {
  margin: 0 !important;
  width: 100% !important;
}

.xs-article-shell .entry-content .wp-block-gallery img {
  aspect-ratio: 1 / 1;
  height: 100% !important;
  object-fit: cover;
  width: 100% !important;
}

.xs-ad {
  background: var(--xs-color-code);
  border: 1px dashed var(--xs-color-line);
  border-radius: var(--xs-radius);
  margin-block: clamp(18px, 4vw, 32px);
  padding: 16px;
  text-align: center;
}

@media (max-width: 782px) {
  .wp-block-post-template.xs-post-grid {
    grid-template-columns: 1fr !important;
  }

  .xs-home-hero h1,
  .xs-article-shell .wp-block-post-title {
    word-break: auto-phrase;
    overflow-wrap: anywhere;
  }

  .xs-article-shell {
    box-shadow: none;
    padding: clamp(20px, 6vw, 32px);
  }

  .xs-article-shell .entry-content .wp-block-gallery {
    grid-template-columns: 1fr;
  }
}

