/* style.css - main 002 (UI refresh)
   - No PHP helper additions. Pure HTML/CSS/JS polish.
*/

:root{
  --bg: #f6fbf7;           /* soft green background */
  --panel: #ffffff;        /* main surface */
  --panel2:#e7f2eb;        /* secondary surface (nav etc.) */        /* secondary surface (nav etc.) */
  --text:#1f2937;          /* readable dark */
  --muted:#6b7280;
  --brand:#6fa98a;         /* gentle green accent */
  --brand2:#4f8f6b;        /* deeper accent */
  --line: rgba(31,41,55,.10);
  --shadow: 0 12px 30px rgba(22,40,30,.10);
  --radius: 16px;
  --radius2: 22px;
  --header-h: 72px;
  --nav-w: 240px;
  --max: 1200px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, Arial, sans-serif;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  letter-spacing: .2px;
}

a{ color: var(--brand); text-decoration:none; }
a:hover{ text-decoration: underline; }
img{ max-width:100%; height:auto; border-radius: 12px; }

.app-header{
  position:fixed;
  top:0; left:0; right:0;
  height: var(--header-h);
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(231,242,235,.78);
  border-bottom: 1px solid var(--line);
}
.app-header__inner{
  height:100%;
  display:flex;
  align-items:center;
  gap:12px;
  padding: 0 16px;
  max-width: calc(var(--max) + var(--nav-w) + 48px);
  margin: 0 auto;
}
.brand{
  display:flex;
  align-items:baseline;
  gap:10px;
  min-width: 0;
}
.brand__title{
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .6px;
  white-space: nowrap;
}
.brand__meta{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.nav-toggle{
  display:none;
  appearance:none;
  border: 1px solid var(--line);
  background: rgba(17,24,39,.06);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
}
.nav-toggle:hover{ background: rgba(17,24,39,.10); }

.nav-check{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

.nav-backdrop{ display:none; }


.container{
  display:block;
  padding-top: var(--header-h);
}
.app-shell{
  display:grid;
  grid-template-columns: var(--nav-w) 1fr;
  gap: 18px;
  padding: 18px;
  max-width: calc(var(--max) + var(--nav-w) + 48px);
  margin: 0 auto;
}

nav{
  position: sticky;
  top: calc(var(--header-h) + 18px);
  align-self: start;
  height: calc(100dvh - var(--header-h) - 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  background: var(--panel2);
  box-shadow: var(--shadow);
  overflow:auto;
  padding: 14px 12px;
}

.nav-title{
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .6px;
  text-transform: uppercase;
  margin: 6px 10px 10px;
}

nav ul{
  list-style:none;
  padding:0;
  margin:0;
  display:flex;
  flex-direction:column;
  gap:6px;
}
nav ul li a{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 10px;
  border-radius: 14px;
  color: var(--text);
  text-decoration:none;
  border: 1px solid transparent;
}
nav ul li a:hover{
  background: rgba(17,24,39,.06);
  border-color: rgba(17,24,39,.08);
  text-decoration:none;
}
nav ul li a .nav-mark{
  color: var(--brand);
  font-weight: 900;
  width: 14px;
  display:inline-block;
  text-align:center;
}

main{
  margin:0;
  padding: 0;
  background: transparent;
  color: var(--text);
  min-width: 0;
}

.page-title{
  margin: 4px 0 14px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .4px;
}

.card{
  border: 1px solid var(--line);
  background: rgba(17,24,39,.04);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
}
.card__inner{ padding: 16px; }
.card__title{
  margin:0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: #f3f4f6;
}
.card__muted{ color: var(--muted); font-size: 12px; }

/* main004: details marker (avoid double chevron) */
details > summary{ list-style: none; }
details > summary::-webkit-details-marker{ display:none; }
details > summary::marker{ content:""; }


.details{
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(17,24,39,.03);
  padding: 10px 12px;
}
.details summary{
  cursor:pointer;
  font-weight: 800;
}
.details summary::-webkit-details-marker{ display:none; }
.details summary:before{
  content:"▸";
  display:inline-block;
  margin-right: 8px;
  color: var(--brand);
  transform: translateY(-1px);
}
.details[open] summary:before{ content:"▾"; }

.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.grid-3{
  display:grid;
  grid-template-columns: 1fr 1fr 280px;
  gap: 14px;
  align-items:start;
}
.feed{
  margin:0;
  padding-left: 1.1em;
}
.feed li{
  margin: 8px 0;
  line-height: 1.5;
}
.feed time{
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border: 1px solid rgba(107,182,166,.35);
  color: var(--brand);
  background: rgba(107,182,166,.08);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge a{ color: inherit; text-decoration:none; }
.badge a:hover{ text-decoration: underline; }

.row-links{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 10px;
}


.filterbar{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  align-items:center;
  margin-top: 10px;
}
.filter-input{
  flex: 1 1 280px;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(17,24,39,.03);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}
.filter-input::placeholder{
  color: var(--muted);
  font-weight: 700;
}
.filter-clear{
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(17,24,39,.03);
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
.filter-clear:hover{ background: rgba(17,24,39,.06); }
.filter-stat{
  flex: 1 1 auto;
  text-align: right;
  min-width: 120px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(17,24,39,.03);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}
.chip:hover{ background: rgba(17,24,39,.06); text-decoration:none; }

.news{
  display:grid;
  grid-template-columns: 420px 1fr;
  gap: 14px;
  align-items:start;
}
.news__meta{ color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.news__title{ margin: 0 0 10px; font-size: 18px; font-weight: 900; }
.news__body{ color: var(--text); line-height: 1.7; }
.news__img{
  border-radius: var(--radius2);
  border: 1px solid var(--line);
  background: rgba(17,24,39,.02);
  padding: 10px;
}
.list{
  margin: 0;
  padding-left: 1.1em;
}
.list li{ margin: 8px 0; }

footer{
  margin-top: 18px;
  padding: 20px 18px 34px;
  color: var(--muted);
}

/* legacy tables (render acceptable even if left in place) */
table{ border-collapse: collapse; width: 100%; }
td,th{ border: 1px solid rgba(17,24,39,.08); padding: 10px; vertical-align: top; }
table[style*="border:none"] td, table[style*="border:none"] th,
td[style*="border:none"], th[style*="border:none"]{
  border: none !important;
  padding: 0 !important;
}

/* --------------------------------------------------
   Mobile
-------------------------------------------------- */
@media (max-width: 980px){
  :root{ --nav-w: 220px; }
  .grid-3{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px){

  .nav-toggle{ display:inline-flex; }
  .app-shell{ grid-template-columns: 1fr; }
  .nav-backdrop{
    display:none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(0,0,0,.25);
    z-index: 50;
  }
  #nav-check:checked ~ .container .nav-backdrop{ display:block; }
  nav{ z-index: 60; }
  nav{
    position: fixed;
    top: var(--header-h);
    left: 12px;
    right: 12px;
    height: auto;
    max-height: calc(100dvh - var(--header-h) - 24px);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events:none;
    transition: .18s ease;
  }
  #nav-check:checked ~ .container nav{
    transform: translateY(0);
    opacity: 1;
    pointer-events:auto;
  }
  .grid-2{ grid-template-columns: 1fr; }
  .grid-3{ grid-template-columns: 1fr; }
  .news{ grid-template-columns: 1fr; }
}

/* ログアウト（控えめ・メニュー下部） */
.nav-logout {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(0,0,0,.15);
}

.nav-logout a {
  font-size: 0.85em;
  color: #888;
  text-decoration: none;
}

.nav-logout a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* =========================================================
   main 003 : soft-green final adjust
   - 文字を一段だけ濃く
   - 背景は単色（途中で色が変わらない）
   - 左メニューは白を使わない
   - Rakuten とその上の余白を少し広げる
   ========================================================= */

/* ------------------------------
   テーマ：薄いグリーン（確定）
------------------------------ */
:root[data-theme="soft-green"]{
  --bg:      #f6fbf7;   /* 全体背景 */
  --panel:   #ffffff;   /* カード */
  --panel2:  #eef6f0;   /* メニュー・サブ面 */
  --line:    #dfece3;   /* 罫線 */
  --shadow:  rgba(40, 80, 60, 0.08);

  --brand:   #6fa98a;
  --brand2:  #4f8f6b;

  /* ★ 可読性調整（今回の肝） */
  --text:    #111827;   /* 本文・リスト */
  --muted:   #4b5563;   /* 日付・補足 */
}

/* ------------------------------
   body 背景：単色固定
   （スクロールで色が変わらない）
------------------------------ */
body{
  background: var(--bg);
  color: var(--text);
}

/* ------------------------------
   左メニュー（白をやめる）
------------------------------ */
.side-nav,
.side-menu,
nav.side{
  background: var(--panel2);
  border-right: 1px solid var(--line);
}

/* ------------------------------
   カード・パネル
------------------------------ */
.card,
.panel,
.box{
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px var(--shadow);
}

/* ------------------------------
   Rakuten 周りの余白調整
------------------------------ */
.rakuten-area{
  margin-top: 16px;   /* 上を少し広く */
}

.rakuten-area .rakuten-box{
  padding: 14px 16px; /* 中の上下余白 */
}

/* ------------------------------
   テキスト微調整
------------------------------ */
p,
li,
dd,
dt{
  color: var(--text);
}

.time,
.date,
.meta,
.small{
  color: var(--muted);
}

/* ------------------------------
   リンク（色は変えない）
------------------------------ */
a{
  color: inherit;
}

a:hover{
  text-decoration: underline;
}


/* =========================================================
   main 004: Rakuten widget responsive (keep visible on mobile)
   - Rakuten script injects fixed-size iframe. Prevent overflow.
   ========================================================= */
.rakuten-widget,
iframe[src*="xml.affiliate.rakuten.co.jp"],
iframe[src*="rakuten.co.jp/widget"]{
  max-width: 100%;
}

@media (max-width: 768px){
  /* make widget block-level and centered */
  iframe[src*="xml.affiliate.rakuten.co.jp"],
  iframe[src*="rakuten.co.jp/widget"]{
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    margin: 8px auto;
  }

  /* if inside a narrow header row, allow wrapping */
  .app-header__inner,
  .header-inner,
  .header-row{
    flex-wrap: wrap;
  }
}

/* ===== main 004 header fix (確定) ===== */

.app-header__inner{
  display: flex;              /* ← これが無かった or 不完全 */
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;          /* 縦積みを絶対させない */
}

/* 三本バー */
.app-header .nav-toggle{
  flex: 0 0 auto;
  line-height: 1;
}

/* タイトル側 */
.app-header .brand{
  flex: 1 1 auto;
  min-width: 0;               /* ★ これが無いとシミュレーターで崩れる */
}

.app-header .brand__title{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
