/*
Theme Name: Yanagi Original
Theme URI: https://yanagiblog.com/
Author: yanagi
Description: やなぎブログ オリジナルテーマ。スマホでの読みやすさを最優先に、ゼロから制作。
Version: 1.0
Text Domain: yanagi-original
*/

@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@500;700;900&family=Noto+Sans+JP:wght@400;500;700&display=swap');

:root {
  --red: #FF3C28;
  --blue: #00C3E3;
  --navy: #1D2B4F;
  --bg: #F4F6FA;
  --text: #24304D;
  --text-soft: #5B6785;
  --white: #FFFFFF;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.9;
}
h1, h2, h3, h4 { font-family: "Zen Maru Gothic", "Hiragino Sans", sans-serif; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }

/* ---------- header ---------- */
.yn-header {
  background: var(--red);
  position: sticky;
  top: 0;
  z-index: 50;
}
.yn-header-in {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.yn-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: .02em;
}
.yn-menu-toggle {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}
.yn-menu-toggle span {
  width: 22px;
  height: 2.5px;
  background: #fff;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.yn-menu-toggle.is-active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.yn-menu-toggle.is-active span:nth-child(2) { opacity: 0; }
.yn-menu-toggle.is-active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.yn-nav {
  position: fixed;
  top: 0; right: 0;
  width: 78%;
  max-width: 320px;
  height: 100vh;
  background: #fff;
  transform: translateX(100%);
  transition: transform .25s ease;
  overflow-y: auto;
  padding: 80px 0 40px;
  box-shadow: -8px 0 24px rgba(0,0,0,.15);
}
.yn-nav.is-open { transform: translateX(0); }
.yn-nav ul { display: flex; flex-direction: column; }
.yn-nav a {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 24px;
  font-weight: 700;
  color: var(--navy);
  border-bottom: 1px solid #f0f1f5;
}
.yn-nav a:hover { color: var(--red); }

/* サブメニュー(カテゴリー別など) */
.yn-nav .menu-item-has-children > a {
  justify-content: space-between;
}
.yn-nav .menu-item-has-children > a::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s ease;
  margin-left: 8px;
  flex-shrink: 0;
}
.yn-nav .menu-item-has-children.is-open > a::after { transform: rotate(-135deg); }
.yn-nav .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height .2s ease;
  background: var(--bg);
}
.yn-nav .menu-item-has-children.is-open > .sub-menu { max-height: 300px; }
.yn-nav .sub-menu a { padding-left: 40px; font-weight: 500; min-height: 46px; }

/* ---------- hero ---------- */
.yn-hero {
  background: linear-gradient(135deg, var(--blue), var(--red));
  color: #fff;
  padding: 56px 20px;
  position: relative;
  overflow: hidden;
}
.yn-hero-tag {
  display: inline-flex;
  background: rgba(255,255,255,.22);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 18px;
}
.yn-hero-title {
  font-size: clamp(30px, 8.5vw, 48px);
  line-height: 1.45;
  font-weight: 900;
  margin: 0 0 16px;
  max-width: 720px;
  position: relative;
  z-index: 2;
}
.yn-hero-desc {
  font-size: 15px;
  line-height: 1.9;
  color: rgba(255,255,255,.92);
  max-width: 520px;
  margin: 0 0 24px;
  position: relative;
  z-index: 2;
}
.yn-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; position: relative; z-index: 2; }
.yn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
}
.yn-btn-white { background: #fff; color: var(--red); }
.yn-btn-ghost { background: rgba(255,255,255,.16); color: #fff; border: 1.5px solid rgba(255,255,255,.55); }

/* ---------- sections ---------- */
.yn-section { max-width: 1100px; margin: 0 auto; padding: 48px 20px; scroll-margin-top: 68px; }
.yn-section-alt { background: #fff; }
.yn-section-title {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 900;
  margin: 0 0 24px;
  padding-left: 12px;
  border-left: 6px solid var(--red);
}
.yn-more { margin-top: 24px; text-align: center; }
.yn-more a { font-weight: 700; color: var(--red); }

/* ---------- card grid ---------- */
.yn-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}
.yn-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(29,43,79,.1);
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.yn-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(29,43,79,.18); }
.yn-card-thumb { position: relative; aspect-ratio: 16/9; background: linear-gradient(135deg, var(--blue), var(--navy)); }
.yn-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.yn-card-thumb-fallback { width: 100%; height: 100%; background: linear-gradient(135deg, var(--blue), var(--navy)); }
.yn-card-cat {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}
.yn-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.yn-card-title { font-size: 13px; font-weight: 700; line-height: 1.55; }
.yn-card-date { font-size: 11px; color: var(--text-soft); margin-top: auto; }

/* ---------- popular ranking list ---------- */
.yn-rank-list { display: flex; flex-direction: column; gap: 0; max-width: 720px; margin: 0 auto; list-style: none; padding-left: 0; }
.yn-rank-item { border-bottom: 1px solid #e6e9f2; }
.yn-rank-item:first-child { border-top: 1px solid #e6e9f2; }
.yn-rank-link {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 8px;
}
.yn-rank-num {
  font-family: "Zen Maru Gothic", sans-serif;
  font-weight: 900;
  font-size: 30px;
  color: var(--red);
  min-width: 36px;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1;
}
.yn-rank-medal { font-size: 32px; }
.yn-rank-thumb { flex-shrink: 0; width: 48px; height: 48px; border-radius: 8px; overflow: hidden; }
.yn-rank-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yn-rank-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.yn-rank-title { font-size: 15px; font-weight: 700; line-height: 1.6; }
.yn-rank-date { font-size: 12px; color: var(--text-soft); }

/* ---------- category grid ---------- */
.yn-cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.yn-cat-card {
  background: var(--bg);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.yn-cat-name { font-weight: 700; font-size: 14px; }
.yn-cat-count { font-size: 12px; color: var(--text-soft); }

/* ---------- article ---------- */
.yn-article { max-width: 780px; margin: 0 auto; padding: 24px 18px 56px; }
.yn-breadcrumb { font-size: 12px; color: var(--text-soft); margin-bottom: 12px; }
.yn-breadcrumb a { color: var(--navy); }
.yn-cat-pill {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.yn-article-title {
  font-size: clamp(21px, 5.5vw, 30px);
  line-height: 1.5;
  font-weight: 900;
  margin: 0 0 10px;
  border-left: 7px solid var(--red);
  padding-left: 12px;
}
.yn-article-meta { font-size: 13px; color: var(--text-soft); margin-bottom: 20px; }
.yn-eyecatch { border-radius: var(--radius); overflow: hidden; margin: 0 auto 24px; max-width: 320px; }
.yn-eyecatch img { width: 100%; }

/* ---------- TOC ---------- */
.yn-toc { background: #fff; border: 2px solid var(--navy); border-radius: 14px; margin: 0 0 28px; overflow: hidden; }
.yn-toc-title { background: var(--navy); color: #fff; font-weight: 700; padding: 10px 16px; font-size: 14px; }
.yn-toc ul { padding: 10px 8px; }
.yn-toc li { border-bottom: 1px solid #f0f1f5; }
.yn-toc li:last-child { border-bottom: none; }
.yn-toc a { display: flex; align-items: center; min-height: 42px; padding: 0 12px; font-size: 14px; color: var(--navy); }
.yn-toc-sub a { padding-left: 28px; font-size: 13px; color: var(--text-soft); }

/* ---------- inline author bio (in-article) ---------- */
.yn-inline-bio {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #fff;
  border: 2px solid var(--blue);
  border-radius: 14px;
  padding: 16px;
  margin: 0 0 28px;
}
.yn-inline-bio-photo {
  width: 90px; height: 90px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 6px 0 8px;
}
.yn-inline-bio-label { font-size: 11px; font-weight: 700; color: var(--text-soft); }
.yn-inline-bio-name { font-family: "Zen Maru Gothic", sans-serif; font-weight: 900; font-size: 15px; margin-bottom: 4px; text-align: center; }
.yn-inline-bio-text { font-size: 13px; line-height: 1.8; color: var(--text); margin: 0 0 8px; }
.yn-inline-bio-link { font-size: 12px; font-weight: 700; color: var(--red); }

/* ---------- post content typography ---------- */
.yn-content, .yn-page-content { font-size: 16px; line-height: 1.95; word-break: break-word; }
.yn-content p, .yn-page-content p { margin: 0 0 1.6em; }
.yn-content img, .yn-page-content img { border-radius: 12px; margin: 1.2em auto; max-width: 320px; cursor: zoom-in; }

/* ---------- lightbox(画像タップで拡大) ---------- */
.yn-lightbox {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(15,20,35,.9);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.yn-lightbox.is-open { display: flex; }
.yn-lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.yn-lightbox-close {
  position: absolute; top: 18px; right: 18px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.yn-content h2 { font-size: clamp(18px, 4.5vw, 22px); font-weight: 900; border-left: 6px solid var(--blue); background: var(--bg); padding: 12px 14px; margin: 2em 0 1em; border-radius: 8px; }
.yn-content h3 { font-size: clamp(16px, 4vw, 19px); font-weight: 700; border-bottom: 3px solid var(--red); padding-bottom: 6px; margin: 1.8em 0 .8em; }
.yn-content a { color: #d92a17; text-decoration: underline; text-underline-offset: 3px; }
.yn-content ul, .yn-content ol { padding-left: 1.6em; margin: 0 0 1.6em; }
.yn-content li { margin-bottom: .5em; }
.yn-content blockquote { border-left: 5px solid var(--blue); background: var(--bg); padding: 14px 18px; margin: 0 0 1.6em; border-radius: 8px; color: var(--text-soft); }
.yn-content table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

/* ---------- related ---------- */
.yn-related { max-width: 780px; margin: 0 auto; padding: 0 18px 56px; }

/* ---------- pagination ---------- */
.yn-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 32px; flex-wrap: wrap; }
.yn-pagination .page-numbers {
  min-width: 40px; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 2px 8px rgba(29,43,79,.1);
}
.yn-pagination .page-numbers.current { background: var(--red); color: #fff; }

/* ---------- profile ---------- */
.yn-profile {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 6px 18px rgba(29,43,79,.1);
}
.yn-profile-avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--red));
  color: #fff;
  font-family: "Zen Maru Gothic", sans-serif;
  font-weight: 900;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.yn-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.yn-profile-name {
  font-family: "Zen Maru Gothic", sans-serif;
  font-weight: 900;
  font-size: 20px;
}
.yn-profile-text { font-size: 14.5px; line-height: 1.9; color: var(--text); margin: 0; }
.yn-profile-tags { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.yn-tag {
  background: var(--bg);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
}

/* ---------- footer ---------- */
.yn-footer { background: var(--navy); color: rgba(255,255,255,.85); margin-top: 40px; }
.yn-footer-in { max-width: 1100px; margin: 0 auto; padding: 40px 20px; text-align: center; }
.yn-footer-logo { font-family: "Zen Maru Gothic", sans-serif; font-weight: 900; font-size: 16px; color: #fff; margin-bottom: 10px; }
.yn-footer-copy { font-size: 12px; color: rgba(255,255,255,.5); }

/* ---------- desktop ---------- */
@media (min-width: 640px) {
  .yn-card-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .yn-cat-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .yn-profile { flex-direction: row; text-align: left; align-items: flex-start; padding: 40px; }
  .yn-profile-tags, .yn-profile-name { justify-content: flex-start; }
}
@media (min-width: 860px) {
  .yn-menu-toggle { display: none; }
  .yn-nav {
    position: static; width: auto; max-width: none; height: auto;
    transform: none; box-shadow: none; padding: 0; background: transparent;
  }
  .yn-nav ul { flex-direction: row; gap: 4px; }
  .yn-nav a { color: #fff; min-height: 40px; padding: 0 14px; border-bottom: none; border-radius: 999px; }
  .yn-nav a:hover { background: rgba(255,255,255,.18); color: #fff; }
  .yn-header-in { padding: 16px 24px; }
  .yn-card-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }

  .yn-nav li { position: relative; }
  .yn-nav .menu-item-has-children > a::after { margin-left: 6px; }
  .yn-nav .sub-menu {
    position: absolute;
    top: 100%; left: 0;
    max-height: none;
    min-width: 160px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(29,43,79,.18);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .15s ease, transform .15s ease;
  }
  .yn-nav .menu-item-has-children:hover > .sub-menu,
  .yn-nav .menu-item-has-children.is-open > .sub-menu {
    opacity: 1; visibility: visible; transform: translateY(0);
  }
  .yn-nav .sub-menu a { color: var(--navy); padding-left: 16px; border-radius: 8px; min-height: 40px; }
  .yn-nav .sub-menu a:hover { background: var(--bg); color: var(--red); }
}
