/*
Theme Name: otopublic
Theme URI: https://otopublic.com
Description: 音パブリック — 音楽をテーマにしたブログ小説サイトのための軽量ブロックテーマ。Light(Riverside Dusk)/Dark(Practice Room Night)対応。
Author: otopublic
Version: 0.1.0
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 8.0
Text Domain: otopublic
*/

/* Reading details that theme.json can't express. Colors come from tokens.css. */
body{ background:var(--otp-bg); color:var(--otp-text); }

/* ホーム・アーカイブは全幅 — theme.jsonの38rem制約を解除 */
.home main.is-layout-constrained,
.archive main.is-layout-constrained {
  max-width: none;
  padding-left: clamp(1rem, 3vw, 2.5rem);
  padding-right: clamp(1rem, 3vw, 2.5rem);
}
/* カレンダー・グリッドの内部幅制限も解除 */
.home .otp-cal         { max-width: none; }
.home .otp-cal-grid    { width: 100%; }
.archive .otp-story-grid { width: 100%; }

/* prose: left-aligned (never justify Japanese), comfortable rhythm */
.entry-content,
.wp-block-post-content{ text-align:left; }
.entry-content p{ margin-block: 0 1.4em; }

/* taxonomy chips */
.otp-chip{
  display:inline-block; font-size:.8rem; line-height:1.6;
  padding:2px 10px; border-radius:20px;
  background:var(--otp-chip-bg); color:var(--otp-chip-fg);
  text-decoration:none; margin:0 4px 4px 0;
}

/* BEHIND badge */
.otp-behind-badge{
  display:inline-block; font-size:.72rem; font-weight:700; letter-spacing:.12em;
  padding:2px 10px; border-radius:20px;
  background:var(--otp-primary); color:var(--otp-on-primary);
}

/* episode meta line */
.otp-episode-meta{ color:var(--otp-muted); font-size:.85rem; margin:.4em 0 1.2em; }
.otp-episode-meta a{ color:var(--otp-muted); }

/* prev/next nav */
.otp-episode-nav{ display:flex; justify-content:space-between; gap:12px;
  margin-top:3em; padding-top:1.2em; border-top:1px solid var(--otp-line); }
.otp-episode-nav a{ color:var(--otp-link); text-decoration:none; max-width:48%; }
.otp-episode-nav .otp-nav-none{ color:var(--otp-muted); opacity:.5; }

/* ad slots */
.otp-ad{
  margin:2em auto; text-align:center;
  max-width:var(--wp--style--global--content-size, 38rem);
}
.otp-ad--episode-after-nav{
  margin-top:2.5em; padding-top:1.5em;
  border-top:1px solid var(--otp-line);
}
.otp-ad ins{ display:block; }

/* main navigation */
.otp-nav {
  display: flex;
  gap: 1.6em;
  align-items: center;
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.otp-nav a {
  color: var(--otp-text);
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.15s;
}
.otp-nav a:hover { opacity: 1; }

/* theme toggle button */
#otp-theme-toggle{
  font: inherit; cursor:pointer; color:var(--otp-text);
  background:transparent; border:1px solid var(--otp-line);
  border-radius:8px; padding:6px 12px;
}

/* ═══════════════════════════════════════════════════════════
   PUBLICATION CALENDAR
   ═══════════════════════════════════════════════════════════ */
.otp-cal {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1em 0 4em;
}

/* ナビゲーション */
.otp-cal-nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2em;
  border-bottom: 2px solid var(--otp-text);
  padding-bottom: 0.6em;
}
.otp-cal-arrow {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--otp-text);
  text-decoration: none;
  opacity: 0.5;
  padding: 0.2em 0.6em;
  transition: opacity 0.15s;
}
.otp-cal-arrow:hover { opacity: 1; }
.otp-cal-period {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
}
.otp-cal-year {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.5;
  letter-spacing: 0.04em;
}
.otp-cal-month {
  font-family: var(--wp--preset--font-family--serif);
  font-size: clamp(2rem, 8vw, 3.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--otp-text);
}

/* 月グリッドカレンダー */
.otp-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--otp-line);
  border-top: 1px solid var(--otp-line);
}

/* 曜日ヘッダー */
.otp-cal-weekday {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--otp-muted);
  text-align: center;
  padding: 0.5em 0;
  border-right: 1px solid var(--otp-line);
  border-bottom: 1px solid var(--otp-line);
}

/* 日付セル */
.otp-cal-cell {
  min-height: 5rem;
  border-right: 1px solid var(--otp-line);
  border-bottom: 1px solid var(--otp-line);
  padding: 0.4em 0.4em 0.5em;
  position: relative;
}
.otp-cal-cell--empty { background: transparent; }
.otp-cal-cell-day {
  font-family: var(--wp--preset--font-family--sans);
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--otp-text);
  opacity: 0.2;
  display: block;
  margin-bottom: 0.3em;
}
.otp-cal-cell--has-post .otp-cal-cell-day {
  opacity: 1;
  color: var(--otp-text);
}

/* セル内の投稿 */
.otp-cal-cell-posts {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}
.otp-cal-post {
  display: block;
  text-decoration: none;
  color: inherit;
  line-height: 1.3;
  transition: opacity 0.12s;
}
.otp-cal-post:hover { opacity: 0.6; }
.otp-cal-title {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.62rem;
  line-height: 1.35;
  display: block;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.otp-cal--ep .otp-cal-title {
  font-weight: 700;
  color: var(--otp-primary);
}
.otp-cal--behind .otp-cal-title {
  font-weight: 400;
  color: var(--otp-muted);
}
.otp-cal--future .otp-cal-title {
  color: var(--otp-accent);
  opacity: 0.7;
}

/* セルに投稿がある日の日付数字をカラーに */
.otp-cal--ep ~ * .otp-cal-cell-day,
.otp-cal-cell--has-post .otp-cal-cell-day {
  color: var(--otp-text);
}

.otp-cal-empty {
  font-family: var(--wp--preset--font-family--sans);
  color: var(--otp-muted);
  margin: 2em 0;
  font-size: 0.9rem;
}

/* スマホ：セルを小さく */
@media (max-width: 500px) {
  .otp-cal-cell { min-height: 3.5rem; padding: 0.25em; }
  .otp-cal-cell-day { font-size: 1rem; }
  .otp-cal-title { font-size: 0.55rem; }
  .otp-cal-weekday { font-size: 0.55rem; }
}

/* ═══════════════════════════════════════════════════════════
   ARCHIVE HEADING — ロック調・超巨大
   ═══════════════════════════════════════════════════════════ */
.otp-archive-heading {
  font-family: var(--wp--preset--font-family--sans);
  font-size: clamp(4rem, 18vw, 10rem);
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 0.9;
  margin-bottom: 0.4em;
  color: var(--otp-text);
  text-transform: uppercase;
  border-bottom: 3px solid var(--otp-text);
  padding-bottom: 0.15em;
}
.otp-empty {
  color: var(--otp-muted);
  font-family: var(--wp--preset--font-family--sans);
  margin: 3em 0;
}

/* ═══════════════════════════════════════════════════════════
   STORY ARCHIVE — 横5列グリッド
   ═══════════════════════════════════════════════════════════ */
.otp-story-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}
@media (max-width: 600px) {
  .otp-story-grid { grid-template-columns: repeat(2, 1fr); }
}
.otp-story-item {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  padding: 1.2em 1em 1.4em 0;
  border-top: 2px solid var(--otp-text);
  border-right: 1px solid var(--otp-line);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}
.otp-story-item:last-child { border-right: none; }
.otp-story-item:hover { background: color-mix(in srgb, var(--otp-primary) 5%, transparent); }
.otp-story-num {
  font-family: var(--wp--preset--font-family--sans);
  font-size: clamp(2.8rem, 7vw, 4.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--otp-text);
  opacity: 0.12;
  margin-bottom: 0.2em;
}
.otp-story-title {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--otp-text);
  margin: 0;
}
.otp-story-excerpt {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.7rem;
  line-height: 1.55;
  color: var(--otp-muted);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   BEHIND TIMELINE — 縦タイムライン
   ═══════════════════════════════════════════════════════════ */
.otp-timeline {
  position: relative;
  padding: 1em 0 3em;
  max-width: 60rem;
  margin: 0 auto;
}
/* 中央の縦線 */
.otp-timeline::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--otp-line);
  transform: translateX(-50%);
}

.otp-tl-item {
  display: grid;
  grid-template-columns: 1fr 2.4rem 1fr;
  align-items: start;
  gap: 0 0;
  margin-bottom: 3em;
  position: relative;
}

/* 番号（左右で配置が変わる） */
.otp-tl-num {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--otp-primary);
  line-height: 2.4rem;
  text-align: center;
}

/* 中央ドット */
.otp-tl-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--otp-primary);
  border: 2px solid var(--otp-bg);
  box-shadow: 0 0 0 1px var(--otp-primary);
  margin: 0.75rem auto 0;
  grid-column: 2;
  grid-row: 1;
}

/* カード */
.otp-tl-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--otp-surface);
  border: 1px solid var(--otp-line);
  border-radius: 8px;
  padding: 1.1em 1.3em;
  transition: border-color 0.15s, transform 0.15s;
}
.otp-tl-card:hover {
  border-color: var(--otp-primary);
  transform: translateY(-2px);
}
.otp-tl-title {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--otp-text);
  margin: 0 0 0.4em;
}
.otp-tl-excerpt {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--otp-muted);
  margin: 0;
}

/* 左側アイテム：カードが左、番号が右 */
.otp-tl-left .otp-tl-card  { grid-column: 1; grid-row: 1; margin-right: 1.5em; }
.otp-tl-left .otp-tl-dot   { grid-column: 2; }
.otp-tl-left .otp-tl-num   { grid-column: 3; text-align: left; padding-left: 0.8em; }

/* 右側アイテム：番号が左、カードが右 */
.otp-tl-right .otp-tl-num  { grid-column: 1; text-align: right; padding-right: 0.8em; }
.otp-tl-right .otp-tl-dot  { grid-column: 2; }
.otp-tl-right .otp-tl-card { grid-column: 3; grid-row: 1; margin-left: 1.5em; }

/* 右側アイテムはドットの色を変える（teal → orange） */
.otp-tl-right .otp-tl-dot {
  background: var(--otp-accent);
  box-shadow: 0 0 0 1px var(--otp-accent);
}
.otp-tl-right .otp-tl-num { color: var(--otp-accent); }

/* モバイル：1カラムに */
@media (max-width: 600px) {
  .otp-timeline::before { left: 1.2rem; }
  .otp-tl-item {
    grid-template-columns: 2.4rem 1fr;
    grid-template-rows: auto;
  }
  .otp-tl-left .otp-tl-card,
  .otp-tl-right .otp-tl-card  { grid-column: 2; grid-row: 1; margin: 0 0 0 1em; }
  .otp-tl-left .otp-tl-dot,
  .otp-tl-right .otp-tl-dot   { grid-column: 1; }
  .otp-tl-left .otp-tl-num,
  .otp-tl-right .otp-tl-num   { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   EPISODE — 静寂な読書室
   ═══════════════════════════════════════════════════════════ */

/* ページ入場 */
.single-episode main {
  animation: episode-enter 0.9s cubic-bezier(.22,.8,.36,1) both;
}
@keyframes episode-enter {
  from { opacity:0; transform:translateY(18px); }
  to   { opacity:1; transform:translateY(0); }
}

/* タイトル：中央 + 下の装飾線 */
.single-episode .wp-block-post-title {
  text-align: center;
  font-size: clamp(1.45rem, 3.5vw, 2rem);
  letter-spacing: 0.1em;
  line-height: 1.5;
  padding-bottom: 1.2em;
  position: relative;
}
.single-episode .wp-block-post-title::after {
  content: '';
  display: block;
  width: 2.4em;
  height: 1px;
  background: var(--otp-accent);
  margin: 0.7em auto 0;
  opacity: 0.7;
}

/* ドロップキャップ：最初の文字 */
.single-episode .wp-block-post-content > p:first-of-type::first-letter {
  font-size: 3em;
  line-height: 0.82;
  float: left;
  margin-right: 0.06em;
  margin-top: 0.08em;
  color: var(--otp-accent);
  font-family: var(--wp--preset--font-family--serif);
}

/* HR → 音符的な区切り */
.single-episode .wp-block-post-content hr {
  border: none;
  height: auto;
  text-align: center;
  margin: 2.8em auto;
  overflow: visible;
}
.single-episode .wp-block-post-content hr::before {
  content: '♩';
  color: var(--otp-muted);
  font-size: 1.1rem;
  opacity: 0.5;
  letter-spacing: 0.3em;
}

/* エピソードメタ：中央揃え */
.single-episode .otp-episode-meta {
  text-align: center;
  margin-bottom: 2em;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

/* prev/next：より詩的な余白 */
.single-episode .otp-episode-nav {
  margin-top: 4em;
  padding-top: 1.8em;
  font-size: 0.88rem;
}

/* ═══════════════════════════════════════════════════════════
   BEHIND NOTE — 制作現場のノート
   ═══════════════════════════════════════════════════════════ */

/* ページ入場 */
.single-behind_note main {
  animation: behind-enter 0.5s ease both;
}
@keyframes behind-enter {
  from { opacity:0; }
  to   { opacity:1; }
}

/* 幅を広げる */
.single-behind_note .wp-block-post-content,
.single-behind_note .wp-block-group.is-layout-constrained > * {
  max-width: 60rem;
}

/* 本文：ゴシック体 */
.single-behind_note .wp-block-post-content {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.97rem;
  line-height: 1.85;
}

/* タイトル：ゴシック・太字 */
.single-behind_note .wp-block-post-title {
  font-family: var(--wp--preset--font-family--sans);
  font-weight: 700;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  letter-spacing: -0.01em;
  line-height: 1.4;
  max-width: 60rem;
}

/* h2：左ボーダー＋背景 */
.single-behind_note .wp-block-post-content h2 {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-left: 3px solid var(--otp-primary);
  padding: 0.3em 0 0.3em 0.85em;
  margin-top: 2.8em;
  margin-bottom: 0.9em;
  background: linear-gradient(90deg, color-mix(in srgb, var(--otp-primary) 6%, transparent) 0%, transparent 60%);
}

/* h3：プライマリカラー */
.single-behind_note .wp-block-post-content h3 {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--otp-primary);
  margin-top: 2em;
  margin-bottom: 0.5em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--otp-line);
}

/* blockquote：ノート的 */
.single-behind_note .wp-block-post-content blockquote,
.single-behind_note .wp-block-post-content blockquote p {
  font-family: var(--wp--preset--font-family--sans);
  font-style: normal;
}
.single-behind_note .wp-block-post-content blockquote {
  border-left: 2px solid var(--otp-accent);
  padding: 0.7em 1.2em;
  margin: 1.6em 0;
  background: color-mix(in srgb, var(--otp-surface) 80%, transparent);
  border-radius: 0 6px 6px 0;
}

/* code：テック感 */
.single-behind_note .wp-block-post-content :not(pre) > code {
  font-size: 0.83em;
  background: var(--otp-surface);
  padding: 0.15em 0.45em;
  border-radius: 3px;
  border: 1px solid var(--otp-line);
  font-family: "Menlo", "Consolas", monospace;
  color: var(--otp-primary);
}

/* HR：シンプルな線 */
.single-behind_note .wp-block-post-content hr {
  border: none;
  border-top: 1px solid var(--otp-line);
  margin: 2.5em 0;
}

/* BADGEとタイトルの間隔 */
.single-behind_note .otp-behind-badge {
  margin-bottom: 0.8em;
  display: inline-block;
}

/* テーブル（behind notesにはテーブルが多い） */
.single-behind_note .wp-block-post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  margin: 1.5em 0;
}
.single-behind_note .wp-block-post-content th {
  background: var(--otp-surface);
  font-weight: 700;
  text-align: left;
  padding: 0.5em 0.8em;
  border-bottom: 2px solid var(--otp-primary);
  font-family: var(--wp--preset--font-family--sans);
}
.single-behind_note .wp-block-post-content td {
  padding: 0.45em 0.8em;
  border-bottom: 1px solid var(--otp-line);
  vertical-align: top;
}
.single-behind_note .wp-block-post-content tr:hover td {
  background: color-mix(in srgb, var(--otp-surface) 60%, transparent);
}
