/*
Theme Name: Soramiru
Theme URI: https://soramiru.net/
Author: Soramiru
Description: 星空観察・天体撮影の入門サイト「そらみる」専用テーマ。星空ヒーロー、PR表記の自動出力、パンくず+構造化データを備えたアフィリエイトサイト向けクラシックテーマ。
Version: 1.2.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: soramiru
*/

/* ==========================================================
   1. Design tokens
   ========================================================== */
:root {
  --navy-deepest: #070f24;
  --navy-deep: #0b1633;
  --navy: #1c2c50;
  --navy-soft: #33415e;
  --ink: #2f3c58;
  --text: #4a556b;
  --muted: #8a94a6;
  --line: #dfe4ec;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --accent: #3a5586;
  --accent-weak: #eef2f8;
  --dawn: #d98e4a;

  --font-serif: "Zen Old Mincho", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --font-sans: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;

  --w-content: 1120px;
  --w-narrow: 720px;
}

/* ==========================================================
   2. Base
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.9;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration: none; transition: opacity .2s ease; }
a:hover { opacity: .72; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: .06em;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 10px 18px;
  background: var(--navy-deep);
  color: #fff;
}
.skip-link:focus { left: 12px; top: 12px; }

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

.container {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 0 24px;
}

/* Sparkle ornament (✦) used across section titles */
.sparkle::before {
  content: "\2726";
  display: block;
  text-align: center;
  color: var(--navy-soft);
  font-size: 15px;
  margin-bottom: 10px;
}

/* ==========================================================
   3. Header (transparent, sits over the hero)
   ========================================================== */
.site-header {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 20;
}

.site-header__inner {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 26px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .04em;
}
.brand:hover { opacity: 1; }
.brand__star { font-size: 18px; line-height: 1; transform: translateY(-1px); }
.brand img { max-height: 36px; width: auto; }

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 34px;
}
.site-nav a {
  color: rgba(255, 255, 255, .92);
  font-size: 15px;
  letter-spacing: .05em;
  padding-bottom: 6px;
}
.site-nav .current-menu-item > a,
.site-nav .current_page_item > a {
  border-bottom: 1px solid rgba(255, 255, 255, .85);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 4px;
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

/* ==========================================================
   4. Hero — the signature: procedural starfield + mountains
   ========================================================== */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 115%, rgba(217,142,74,.30) 0%, rgba(217,142,74,0) 42%),
    linear-gradient(180deg, var(--navy-deepest) 0%, var(--navy-deep) 46%, #24365e 78%, #3b4f7c 100%);
  color: #fff;
}

.hero--tall { min-height: 88vh; }
.hero--page { min-height: 340px; }

/* Custom header image replaces the gradient sky */
.hero--image {
  background-size: cover;
  background-position: center;
}
.hero--image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7,15,36,.45), rgba(7,15,36,.15));
  pointer-events: none;
}

.hero__inner {
  position: relative;
  z-index: 5;
  min-height: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 140px 24px 120px;
}
.hero--page .hero__inner { padding: 130px 24px 90px; }

.hero__sparkle {
  font-size: 20px;
  margin-bottom: 22px;
  opacity: .95;
}

.hero__label {
  font-family: var(--font-serif);
  font-size: 40px;
  letter-spacing: .12em;
  margin: 0 0 10px;
  color: #fff;
  font-weight: 400;
}

.hero__title {
  font-family: var(--font-serif);
  font-size: clamp(30px, 4.6vw, 46px);
  letter-spacing: .22em;
  line-height: 2;
  margin: 0;
  color: #fff;
  font-weight: 400;
}

.hero__lead {
  font-size: 15px;
  letter-spacing: .12em;
  margin-top: 26px;
  color: rgba(255,255,255,.88);
}

.hero__scroll {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.8);
  font-size: 22px;
  z-index: 6;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* Mountain silhouette pinned to the hero base */
.hero__mountain {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  z-index: 4;
  line-height: 0;
}
.hero__mountain svg { width: 100%; height: 120px; display: block; }
.hero--tall .hero__mountain svg { height: 160px; }

/* Starfield (spans injected by main.js) */
.hero__stars { position: absolute; inset: 0; z-index: 2; }
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  animation: twinkle var(--tw, 4s) ease-in-out infinite;
  animation-delay: var(--td, 0s);
}
@keyframes twinkle {
  0%, 100% { opacity: var(--o, .8); }
  50% { opacity: .15; }
}

.shooting-star {
  position: absolute;
  top: 14%;
  right: -160px;
  width: 150px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.9));
  transform: rotate(-24deg);
  animation: shoot 9s ease-in 3s infinite;
  z-index: 3;
  opacity: 0;
}
@keyframes shoot {
  0% { opacity: 0; transform: translate(0,0) rotate(-24deg); }
  3% { opacity: 1; }
  8% { opacity: 0; transform: translate(-64vw, 28vw) rotate(-24deg); }
  100% { opacity: 0; transform: translate(-64vw, 28vw) rotate(-24deg); }
}

@media (prefers-reduced-motion: reduce) {
  .star, .shooting-star, .hero__scroll { animation: none; }
  html { scroll-behavior: auto; }
}

/* ==========================================================
   5. Breadcrumb
   ========================================================== */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  padding: 22px 0 0;
}
.breadcrumb ol {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.breadcrumb li + li::before {
  content: "\003E";
  margin-right: 6px;
  color: var(--line);
}
.breadcrumb a { color: var(--muted); }

/* ==========================================================
   6. Layout (content + sidebar)
   ========================================================== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 64px;
  /* 左右の余白は .container 側(24px)に任せ、ここでは上下のみ指定する */
  padding-top: 40px;
  padding-bottom: 90px;
}

.layout--single {
  grid-template-columns: minmax(0, 1fr);
  max-width: var(--w-narrow);
  margin: 0 auto;
}

/* ==========================================================
   7. Post list (blog / archive)
   ========================================================== */
.post-list { display: flex; flex-direction: column; }

.post-list__item {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  padding: 34px 0;
  border-bottom: 1px solid var(--line);
}
.post-list__item:first-child { padding-top: 10px; }

.post-list__thumb {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--navy-deep);
}
.post-list__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.post-list__item:hover .post-list__thumb img { transform: scale(1.04); }

.entry-date {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .06em;
}

.cat-badge--sm {
  font-size: 11px;
  padding: 2px 9px;
  margin-left: 10px;
  margin-right: 0;
  vertical-align: 1px;
}

.mini-post__cat {
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
}

.post-list__title {
  font-size: 22px;
  margin: 8px 0 10px;
}
.post-list__title a { color: var(--ink); }

.post-list__excerpt {
  font-size: 14px;
  margin: 0 0 14px;
  color: var(--text);
}

.more-link {
  font-size: 14px;
  letter-spacing: .08em;
  color: var(--navy-soft);
}
.more-link::after { content: "\00a0\2192"; }

/* Pagination */
.pagination { margin-top: 44px; text-align: center; }
.pagination .nav-links {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  color: var(--navy-soft);
  font-size: 14px;
}
.pagination .page-numbers.current {
  background: var(--navy-soft);
  border-color: var(--navy-soft);
  color: #fff;
}
.pagination .page-numbers.dots { border: none; }

/* ==========================================================
   8. Single post
   ========================================================== */
.entry-header { padding-top: 26px; }

.entry-title {
  font-size: clamp(26px, 3.4vw, 34px);
  margin: 10px 0 16px;
}

.cat-badge {
  display: inline-block;
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--navy-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px 12px;
  margin-right: 6px;
}

/* PR notice — stealth-marketing compliance, auto-printed by the theme */
.pr-note {
  margin: 22px 0 0;
  padding: 10px 16px;
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--navy-soft);
  background: var(--accent-weak);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.entry-thumb { margin: 26px 0 34px; }
.entry-thumb img { width: 100%; }

/* --- Block-editor content --- */
.entry-content { font-size: 16px; }
.entry-content > * { margin-top: 0; margin-bottom: 1.7em; }

.entry-content h2 {
  font-size: 24px;
  margin-top: 2.4em;
  padding-bottom: .5em;
  border-bottom: 1px solid var(--line);
}
.entry-content h3 {
  font-size: 20px;
  margin-top: 2em;
  padding-left: 14px;
  border-left: 3px solid var(--navy-soft);
}
.entry-content h4 { font-size: 17px; margin-top: 1.8em; }

.entry-content ul, .entry-content ol { padding-left: 1.6em; }
.entry-content li { margin-bottom: .4em; }

.entry-content blockquote {
  margin: 0 0 1.7em;
  padding: 18px 22px;
  background: var(--bg-soft);
  border-left: 3px solid var(--line);
  color: var(--navy-soft);
}

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.entry-content th, .entry-content td {
  border: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
}
.entry-content th { background: var(--bg-soft); font-weight: 500; }

.entry-content code {
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: .9em;
}
.entry-content pre {
  background: var(--navy-deep);
  color: #e8ecf4;
  padding: 20px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
}
.entry-content pre code { background: none; padding: 0; }

.entry-content figure { margin-left: 0; margin-right: 0; }
.entry-content figcaption {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

/* --- 商品リンク(ポチップ等)の枠 --- */
.entry-content .pochipp-box,
.entry-content .easyLink-box,
.entry-content .kaerebalink-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 22px 22px 18px;
  margin: 2em 0;
  box-shadow: 0 1px 3px rgba(47, 60, 88, .06);
}

.entry-content .wp-block-button__link {
  background: var(--navy-soft);
  color: #fff;
  border-radius: 4px;
  padding: 12px 28px;
  font-size: 15px;
}

/* Share */
.share {
  margin-top: 56px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.share__label { font-size: 13px; color: var(--muted); letter-spacing: .08em; }
.share__links { display: flex; gap: 20px; margin-top: 12px; }
.share__links a, .share__links button {
  color: var(--navy-soft);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}
.share__links svg { width: 21px; height: 21px; fill: currentColor; }

/* Prev / Next */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 46px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.post-nav__item { padding: 22px 10px; }
.post-nav__item--next { text-align: right; border-left: 1px solid var(--line); }
.post-nav__dir { font-size: 12px; color: var(--muted); letter-spacing: .08em; display: block; margin-bottom: 6px; }
.post-nav__title { font-family: var(--font-serif); font-size: 16px; color: var(--ink); }

/* ==========================================================
   9. Sidebar
   ========================================================== */
.sidebar { font-size: 14px; }

.widget { margin-bottom: 56px; }

.widget__title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: .1em;
  text-align: center;
  color: var(--ink);
  margin: 0 0 6px;
}
.widget__rule {
  border: none;
  border-top: 1px solid var(--line);
  margin: 14px 0 22px;
}

/* Search */
.search-form { display: flex; border: 1px solid var(--line); }
.search-form input[type="search"] {
  flex: 1;
  border: none;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-sans);
  min-width: 0;
}
.search-form input[type="search"]:focus { outline: none; }
.search-form button {
  background: none;
  border: none;
  padding: 0 14px;
  cursor: pointer;
  color: var(--navy-soft);
}
.search-form svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }

/* Recent posts */
.mini-post {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.mini-post__thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--navy-deep);
}
.mini-post__thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-post__date { font-size: 12px; color: var(--muted); display: block; }
.mini-post__title { color: var(--ink); font-size: 13.5px; line-height: 1.6; }

/* Categories / Archives */
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
}
.side-list a { color: var(--navy-soft); }
.side-list .count { color: var(--muted); font-size: 13px; }

/* ==========================================================
   10. Front page — New Posts cards
   ========================================================== */
.section { padding: 84px 0; }
.section--soft { background: var(--bg-soft); }

.section__title {
  font-size: 26px;
  letter-spacing: .14em;
  text-align: center;
  margin: 0 0 4px;
  font-weight: 400;
}
.section__sub {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .1em;
  margin: 0 0 46px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.post-card {
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.post-card__thumb { aspect-ratio: 3 / 2; overflow: hidden; background: var(--navy-deep); }
.post-card__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.post-card:hover .post-card__thumb img { transform: scale(1.04); }
.post-card__body { padding: 22px 22px 26px; }
.post-card__title { font-size: 17px; margin: 6px 0 10px; }
.post-card__title a { color: var(--ink); }
.post-card__excerpt { font-size: 13px; margin: 0 0 16px; }
.post-card__arrow { font-size: 18px; color: var(--navy-soft); }

.button-outline {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--navy-soft);
  color: var(--navy-soft);
  font-size: 14px;
  letter-spacing: .1em;
  padding: 14px 38px;
  transition: background .2s ease, color .2s ease;
}
.button-outline:hover {
  background: var(--navy-soft);
  color: #fff;
  opacity: 1;
}
.center { text-align: center; }
.mt-lg { margin-top: 48px; }

/* ==========================================================
   11. Footer
   ========================================================== */
.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  padding: 52px 0 44px;
  text-align: center;
}
.site-footer .sparkle::before { margin-bottom: 22px; }
.footer-nav ul {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 22px;
  font-size: 13px;
}
.footer-nav a { color: var(--navy-soft); }
.copyright { font-size: 12.5px; color: var(--muted); letter-spacing: .06em; }

/* 404 / no results */
.nothing-found {
  text-align: center;
  padding: 60px 0 20px;
}

/* ==========================================================
   12. Responsive
   ========================================================== */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 70px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 15px; }

  /* テーブルは横スクロール(列を潰さない) */
  .entry-content .wp-block-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .entry-content .wp-block-table > table { min-width: 560px; }
  .entry-content > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: rgba(7, 15, 36, .97);
    padding: 12px 24px 22px;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 4px; }
  .site-nav a { display: block; padding: 12px 0; }

  .hero--tall { min-height: 72vh; }
  .hero__inner { padding: 110px 20px 90px; }
  .hero__title { letter-spacing: .14em; }

  .post-list__item { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .post-nav { grid-template-columns: minmax(0, 1fr); }
  .post-nav__item--next { border-left: none; border-top: 1px solid var(--line); }
}
