/*
Theme Name: Win11 Explorer Blog
Theme URI: https://rpa.yurikamome.org/
Author: yurikamome
Author URI: https://rpa.yurikamome.org/
Description: Windows 11 エクスプローラー風のWordPressテーマ。非エンジニア向けPower Automate・RPA解説ブログ用。サイドバーにフォルダツリー、記事をファイル形式で表示。
Version: 1.0.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: win11-blog
*/

/* ===========================
   リセット & ベース
=========================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --win-bg:          #f3f3f3;
  --win-surface:     #ffffff;
  --win-sidebar-bg:  #ebebeb;
  --win-toolbar-bg:  #f9f9f9;
  --win-border:      #d8d8d8;
  --win-border-soft: #e8e8e8;
  --win-accent:      #0067c0;
  --win-accent-bg:   #cce4f7;
  --win-accent-hover:#ddeeff;
  --win-text:        #1a1a1a;
  --win-text-muted:  #666666;
  --win-text-light:  #999999;
  --win-folder:      #ffb900;
  --win-folder-bg:   #fff8e6;
  --win-new-badge:   #0067c0;
  --win-radius:      6px;
  --win-radius-lg:   10px;
  --sidebar-width:   230px;
  --font-ui:        'Segoe UI', 'Yu Gothic UI', 'Meiryo UI', 'Noto Sans JP', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --win-bg:          #202020;
    --win-surface:     #2d2d2d;
    --win-sidebar-bg:  #272727;
    --win-toolbar-bg:  #2a2a2a;
    --win-border:      #3d3d3d;
    --win-border-soft: #383838;
    --win-accent:      #60adf0;
    --win-accent-bg:   #1a3a5c;
    --win-accent-hover:#1e3f60;
    --win-text:        #f0f0f0;
    --win-text-muted:  #aaaaaa;
    --win-text-light:  #777777;
    --win-folder:      #ffb900;
    --win-folder-bg:   #2a2400;
  }
}

body {
  font-family: var(--font-ui);
  font-size: 14px;
  background: var(--win-bg);
  color: var(--win-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--win-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

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

/* ===========================
   ページ全体レイアウト
=========================== */
#page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===========================
   タイトルバー（最上部）
=========================== */
#titlebar {
  background: var(--win-toolbar-bg);
  border-bottom: 1px solid var(--win-border);
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 200;
}

#titlebar .site-title-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--win-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
#titlebar .site-title-link:hover {
  color: var(--win-accent);
  text-decoration: none;
}
#titlebar .title-icon {
  font-size: 16px;
}
#titlebar .spacer { flex: 1; }
#titlebar .titlebar-search {
  display: flex;
  align-items: center;
  background: var(--win-surface);
  border: 1px solid var(--win-border);
  border-radius: 4px;
  padding: 0 8px;
  height: 24px;
  gap: 6px;
}
#titlebar .titlebar-search input {
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--win-text);
  outline: none;
  width: 180px;
}
#titlebar .titlebar-search .search-icon {
  color: var(--win-text-muted);
  font-size: 12px;
}

/* ===========================
   ツールバー（アドレスバー）
=========================== */
#toolbar {
  background: var(--win-toolbar-bg);
  border-bottom: 1px solid var(--win-border);
  padding: 5px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 36px;
  z-index: 190;
  flex-wrap: wrap;
}

.toolbar-nav-btn {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: var(--win-radius);
  background: transparent;
  color: var(--win-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.1s;
}
.toolbar-nav-btn:hover {
  background: var(--win-border-soft);
  border-color: var(--win-border);
  text-decoration: none;
  color: var(--win-text);
}

#address-bar {
  flex: 1;
  min-width: 200px;
  background: var(--win-surface);
  border: 1px solid var(--win-border);
  border-radius: 4px;
  padding: 3px 10px;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 12px;
  overflow: hidden;
}
#address-bar .addr-home {
  color: var(--win-accent);
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
#address-bar .addr-home:hover {
  text-decoration: underline;
}
#address-bar .addr-sep {
  color: var(--win-text-light);
  margin: 0 4px;
  font-size: 11px;
}
#address-bar .addr-crumb {
  color: var(--win-accent);
  text-decoration: none;
  white-space: nowrap;
}
#address-bar .addr-crumb:hover {
  text-decoration: underline;
}
#address-bar .addr-current {
  color: var(--win-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===========================
   メインレイアウト（サイドバー + コンテンツ）
=========================== */
#main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===========================
   サイドバー（フォルダツリー）
=========================== */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--win-sidebar-bg);
  border-right: 1px solid var(--win-border);
  overflow-y: auto;
  padding: 8px 0 24px;
  font-size: 13px;
}

.sidebar-section-label {
  padding: 10px 12px 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--win-text-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 12px;
  cursor: pointer;
  border-radius: var(--win-radius);
  margin: 1px 4px;
  color: var(--win-text);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-item:hover {
  background: var(--win-accent-hover);
  text-decoration: none;
  color: var(--win-text);
}
.tree-item.active {
  background: var(--win-accent-bg);
  color: var(--win-accent);
  font-weight: 500;
}
.tree-item.depth-1 { padding-left: 24px; }
.tree-item.depth-2 { padding-left: 38px; }
.tree-item.depth-3 { padding-left: 52px; }

.tree-icon { font-size: 15px; flex-shrink: 0; }
.tree-label { overflow: hidden; text-overflow: ellipsis; }
.tree-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--win-text-light);
  background: var(--win-border-soft);
  border-radius: 10px;
  padding: 0 5px;
  flex-shrink: 0;
}

/* 最近見た記事 */
#recent-history .tree-item {
  font-size: 12px;
}

/* ===========================
   コンテンツエリア
=========================== */
#content-area {
  flex: 1;
  background: var(--win-surface);
  overflow-y: auto;
  padding: 20px 24px;
  min-width: 0;
}

/* ===========================
   コンテンツヘッダー（件数・ビュー切替）
=========================== */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--win-border-soft);
}
.content-header-title {
  font-size: 14px;
  color: var(--win-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.content-count {
  font-size: 12px;
  color: var(--win-text-muted);
}

/* ===========================
   記事グリッド（フォルダビュー）
=========================== */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.file-card {
  border: 1px solid var(--win-border-soft);
  border-radius: var(--win-radius);
  padding: 12px 8px 10px;
  cursor: pointer;
  text-align: center;
  background: var(--win-surface);
  text-decoration: none;
  color: var(--win-text);
  display: block;
  transition: background 0.1s, border-color 0.1s;
}
.file-card:hover {
  background: var(--win-accent-hover);
  border-color: #99c2e8;
  text-decoration: none;
  color: var(--win-text);
}
.file-card:focus {
  outline: 2px solid var(--win-accent);
  outline-offset: 1px;
}

.file-card.is-folder {
  background: var(--win-folder-bg);
}
.file-card.is-folder:hover {
  background: #fff0b3;
  border-color: var(--win-folder);
}

.file-icon {
  font-size: 32px;
  margin-bottom: 6px;
  line-height: 1;
  display: block;
}
.file-name {
  font-size: 11px;
  line-height: 1.4;
  word-break: break-all;
  color: var(--win-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-meta {
  font-size: 10px;
  color: var(--win-text-light);
  margin-top: 4px;
}
.file-badge {
  display: inline-block;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--win-accent);
  color: #fff;
  margin-left: 3px;
  vertical-align: middle;
}

/* ===========================
   記事リストビュー
=========================== */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.file-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--win-radius);
  text-decoration: none;
  color: var(--win-text);
  font-size: 13px;
  transition: background 0.1s;
  border: 1px solid transparent;
}
.file-list-item:hover {
  background: var(--win-accent-hover);
  border-color: #99c2e8;
  text-decoration: none;
  color: var(--win-text);
}
.file-list-item .li-icon { font-size: 18px; flex-shrink: 0; }
.file-list-item .li-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list-item .li-cat  { font-size: 11px; color: var(--win-text-muted); white-space: nowrap; }
.file-list-item .li-date { font-size: 11px; color: var(--win-text-light); white-space: nowrap; min-width: 80px; text-align: right; }

/* ===========================
   単一記事（article）
=========================== */
.single-article {
  max-width: 820px;
}

.article-file-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--win-border-soft);
}
.article-file-icon { font-size: 40px; flex-shrink: 0; }
.article-title-block {}
.article-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--win-text);
  line-height: 1.4;
  margin-bottom: 4px;
}
.article-meta {
  font-size: 12px;
  color: var(--win-text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.article-meta .meta-cat {
  background: var(--win-accent-bg);
  color: var(--win-accent);
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
}

/* 記事本文 */
.entry-content {
  font-size: 15px;
  line-height: 1.85;
  color: var(--win-text);
}
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4 {
  margin: 1.8em 0 0.6em;
  font-weight: 600;
  line-height: 1.4;
  color: var(--win-text);
}
.entry-content h1 { font-size: 22px; border-bottom: 2px solid var(--win-accent); padding-bottom: 6px; }
.entry-content h2 { font-size: 18px; border-bottom: 1px solid var(--win-border); padding-bottom: 4px; }
.entry-content h3 { font-size: 16px; }
.entry-content p  { margin: 0.9em 0; }
.entry-content ul,
.entry-content ol { margin: 0.8em 0 0.8em 1.6em; }
.entry-content li { margin: 0.3em 0; }
.entry-content blockquote {
  border-left: 3px solid var(--win-accent);
  margin: 1em 0;
  padding: 8px 16px;
  background: var(--win-accent-bg);
  border-radius: 0 var(--win-radius) var(--win-radius) 0;
  color: var(--win-text-muted);
  font-size: 14px;
}
.entry-content code {
  background: var(--win-sidebar-bg);
  border: 1px solid var(--win-border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 13px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
}
.entry-content pre {
  background: var(--win-sidebar-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--win-radius);
  padding: 12px 16px;
  overflow-x: auto;
  margin: 1em 0;
}
.entry-content pre code {
  background: none;
  border: none;
  padding: 0;
}
.entry-content img {
  border: 1px solid var(--win-border);
  border-radius: var(--win-radius);
  margin: 0.8em 0;
}
.entry-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: 14px;
}
.entry-content th {
  background: var(--win-sidebar-bg);
  border: 1px solid var(--win-border);
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
}
.entry-content td {
  border: 1px solid var(--win-border);
  padding: 6px 10px;
}
.entry-content tr:nth-child(even) td {
  background: var(--win-bg);
}

/* 記事ナビ（前後） */
.article-nav {
  display: flex;
  gap: 10px;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--win-border-soft);
}
.article-nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--win-border);
  border-radius: var(--win-radius);
  text-decoration: none;
  color: var(--win-text);
  background: var(--win-surface);
  font-size: 12px;
  transition: background 0.1s;
}
.article-nav-btn:hover {
  background: var(--win-accent-hover);
  border-color: #99c2e8;
  text-decoration: none;
  color: var(--win-text);
}
.article-nav-btn .nav-icon { font-size: 16px; flex-shrink: 0; }
.article-nav-btn .nav-label { font-size: 10px; color: var(--win-text-muted); display: block; }
.article-nav-btn .nav-title { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.article-nav-btn.nav-next { text-align: right; flex-direction: row-reverse; }

/* ===========================
   ステータスバー
=========================== */
#statusbar {
  background: var(--win-toolbar-bg);
  border-top: 1px solid var(--win-border);
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  font-size: 11px;
  color: var(--win-text-muted);
}
#statusbar .sb-divider {
  width: 1px;
  height: 14px;
  background: var(--win-border);
}
#statusbar .sb-spacer { flex: 1; }

/* ===========================
   ページネーション
=========================== */
.win-pagination {
  display: flex;
  gap: 4px;
  margin-top: 24px;
  justify-content: center;
  flex-wrap: wrap;
}
.win-pagination a,
.win-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--win-border);
  border-radius: var(--win-radius);
  font-size: 12px;
  text-decoration: none;
  color: var(--win-text);
  background: var(--win-surface);
  transition: background 0.1s;
}
.win-pagination a:hover {
  background: var(--win-accent-hover);
  border-color: #99c2e8;
}
.win-pagination .current {
  background: var(--win-accent);
  border-color: var(--win-accent);
  color: #fff;
}

/* ===========================
   404 / 検索結果なし
=========================== */
.win-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--win-text-muted);
}
.win-empty .empty-icon { font-size: 48px; margin-bottom: 12px; }
.win-empty p { font-size: 14px; }

/* ===========================
   レスポンシブ
=========================== */
@media (max-width: 768px) {
  :root { --sidebar-width: 200px; }
  #sidebar { display: none; }
  #sidebar.open { display: block; position: fixed; top: 0; left: 0; height: 100vh; z-index: 300; box-shadow: 4px 0 12px rgba(0,0,0,.15); }
  #main-layout { flex-direction: column; }
  #content-area { padding: 14px 16px; }
  .mobile-sidebar-btn { display: flex !important; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
@media (min-width: 769px) {
  .mobile-sidebar-btn { display: none !important; }
}
