/*
Theme Name: ecoledefx-blog
Theme URI: https://ecoledefx.xyz/blog/
Author: FX白熱教室
Description: FX白熱教室ブログ用カスタムテーマ。プラグイン不要・モバイルファースト。
Version: 1.0.0
Text Domain: ecoledefx-blog
*/

/* 1. CSS Custom Properties
 *==================================*/
:root {
  --color-primary: #2563EB;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #93c5fd;
  --color-primary-bg: #eff6ff;
  --color-text: #263238;
  --color-text-sp: #33363D;
  --color-text-light: #808080;
  --color-link: #337fcc;
  --color-link-sp: #0077b3;
  --color-bg-light: #f9f9f9;
  --color-bg-gray: #f7f7f7;
  --color-border: #e9e9e9;
  --color-border-light: #ccc;
  --font-family-base: -apple-system, 'BlinkMacSystemFont', 'Hiragino Kaku Gothic ProN', 'Noto Sans Japanese', sans-serif;
  --shadow-sm: 0 1px 1px rgba(0,0,0,.2);
  --shadow-md: 0 1px 1px 1px rgba(153,153,153,.3);
  --header-height: 56px;
  --header-height-sp: 46px;
  --header-nav-height: 34px;
}

/* 2. Reset & Base
 *==================================*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-family-base);
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text-sp);
  background: #fff;
  -webkit-font-feature-settings: 'palt';
  font-feature-settings: 'palt';
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--color-link-sp); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

@media (min-width: 768px) {
  body { font-size: 15px; color: var(--color-text); }
  a { color: var(--color-link); }
}

/* 3. Header
 *==================================*/
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height-sp);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 16px;
  max-width: 1200px;
  margin: 0 auto;
}
.site-brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  text-decoration: none;
  color: var(--color-text);
}
.site-brand:hover { text-decoration: none; }
.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
}
.brand-since {
  font-size: 10px;
  color: var(--color-text-light);
}

/* Mobile nav toggle */
.nav-toggle { display: none; }
.nav-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle-label span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  transition: transform .2s, opacity .2s;
}
.nav-toggle:checked ~ .header-inner .nav-toggle-label span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle:checked ~ .header-inner .nav-toggle-label span:nth-child(2) {
  opacity: 0;
}
.nav-toggle:checked ~ .header-inner .nav-toggle-label span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.header-nav {
  position: absolute;
  top: var(--header-height-sp);
  left: 0; right: 0;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.nav-toggle:checked ~ .header-nav {
  max-height: 400px;
}
.header-nav ul {
  padding: 8px 0;
}
.header-nav li a {
  display: block;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  text-align: right;
  transition: background .2s;
}
.header-nav li a:hover {
  background: var(--color-bg-light);
  text-decoration: none;
}

@media (min-width: 768px) {
  .site-header { height: auto; }
  .header-inner { height: var(--header-height); padding: 0 24px; }
  .brand-name { font-size: 18px; }
  .brand-since { font-size: 11px; }
  .nav-toggle-label { display: none; }
  .header-nav {
    position: static;
    max-height: none;
    border-bottom: none;
    overflow: visible;
  }
  .header-nav ul {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 0;
  }
  .header-nav li a {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    text-align: center;
  }
}

/* 4. Breadcrumb (Fixed)
 *==================================*/
.breadcrumb {
  position: fixed;
  top: var(--header-height-sp);
  left: 0;
  right: 0;
  z-index: 999;
  padding: 7px 16px;
  font-size: 12px;
  color: var(--color-text-light);
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}
.breadcrumb ol {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  max-width: 1200px;
  margin: 0 auto;
}
.breadcrumb li {
  white-space: nowrap;
  flex-shrink: 0;
}
.breadcrumb li::after {
  content: '>';
  margin-left: 4px;
  color: #ccc;
}
.breadcrumb li:last-child {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb li:last-child::after { content: ''; margin-left: 0; }
.breadcrumb a { color: var(--color-link-sp); }
.breadcrumb a:hover { text-decoration: underline; }

@media (min-width: 768px) {
  .breadcrumb {
    top: calc(var(--header-height) + var(--header-nav-height));
    padding: 8px 24px;
    font-size: 13px;
  }
  .breadcrumb a { color: var(--color-link); }
}

/* 5. Main Content Layout
 *==================================*/
.site-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px 40px;
  padding-top: calc(var(--header-height-sp) + 36px);
  flex: 1;
}

@media (min-width: 768px) {
  .site-main {
    padding: 0 24px 60px;
    padding-top: calc(var(--header-height) + var(--header-nav-height) + 44px);
  }
}

/* 6. Article Header
 *==================================*/
.entry-header {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
}
.entry-meta {
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.entry-meta .cat-link {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}
.entry-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-text);
}

@media (min-width: 768px) {
  .entry-header { padding: 32px 0 24px; }
  .entry-title { font-size: 28px; }
}

/* 7. Article Body
 *==================================*/
.entry-content h2 {
  font-size: 18px;
  font-weight: 700;
  padding: 12px 16px;
  margin: 36px 0 16px;
  background: var(--color-bg-light);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 4px 4px 0;
  color: var(--color-text);
}
.entry-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 24px 0 10px;
  padding-left: 12px;
  border-left: 3px solid var(--color-primary-light);
  color: var(--color-text);
}
.entry-content p {
  margin-bottom: 16px;
  line-height: 1.85;
}
.entry-content ul,
.entry-content ol {
  margin: 0 0 16px 24px;
  line-height: 1.85;
  list-style: revert;
}
.entry-content li { margin-bottom: 6px; }
.entry-content strong { color: var(--color-text); }
.entry-content blockquote {
  border-left: 3px solid var(--color-border);
  padding: 12px 16px;
  margin: 16px 0;
  background: var(--color-bg-light);
  font-size: 13px;
  color: var(--color-text-light);
}
.entry-content a { color: var(--color-link-sp); }
.entry-content a:hover { text-decoration: underline; }

/* Tables */
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
}
.entry-content th,
.entry-content td {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}
.entry-content th {
  background: var(--color-bg-light);
  font-weight: 600;
  font-size: 12px;
  color: var(--color-text-light);
}
/* Responsive table */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0;
}

@media (min-width: 768px) {
  .entry-content h2 { font-size: 20px; padding: 14px 20px; }
  .entry-content h3 { font-size: 17px; }
  .entry-content p { font-size: 15px; }
  .entry-content ul,
  .entry-content ol { font-size: 15px; }
  .entry-content table { font-size: 14px; }
  .entry-content a { color: var(--color-link); }
}

/* 7b. Table of Contents
 *==================================*/
.toc {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 6px 6px 0;
  padding: 18px 20px;
  margin: 20px 0 28px;
}
.toc-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 10px;
  padding: 0;
}
.toc ol {
  margin: 0 0 0 20px;
  padding: 0;
  counter-reset: toc-counter;
  list-style: none;
}
.toc ol li {
  counter-increment: toc-counter;
  margin-bottom: 6px;
  line-height: 1.6;
  font-size: 13px;
}
.toc ol li::before {
  content: counter(toc-counter) ".";
  color: var(--color-primary);
  font-weight: 700;
  margin-right: 6px;
}
.toc ol li a {
  color: var(--color-text);
  text-decoration: none;
}
.toc ol li a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}
@media (min-width: 768px) {
  .toc { padding: 22px 28px; }
  .toc-title { font-size: 15px; }
  .toc ol li { font-size: 14px; }
}

/* 8. Post Navigation
 *==================================*/
.post-nav {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.post-nav a {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 9. Archive / Index
 *==================================*/
.archive-header {
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
}
.archive-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}
.archive-header p {
  font-size: 13px;
  color: var(--color-text-light);
  margin-top: 4px;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.post-card {
  display: block;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: box-shadow .2s, border-color .2s;
  text-decoration: none;
  color: var(--color-text);
}
.post-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary-light);
  text-decoration: none;
}
.post-card__meta {
  font-size: 11px;
  color: var(--color-text-light);
  margin-bottom: 6px;
  display: flex;
  gap: 8px;
}
.post-card__cat {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
}
.post-card__title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 6px;
}
.post-card__excerpt {
  font-size: 13px;
  color: var(--color-text-light);
  line-height: 1.6;
}

@media (min-width: 768px) {
  .post-list { gap: 12px; }
  .post-card { padding: 20px; }
  .post-card__title { font-size: 16px; }
}

/* 9.5. Pillar Cards (Top Page)
 *==================================*/
.pillar-cards {
  margin: 24px 0 32px;
}
.pillar-cards__heading {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-left: 12px;
  border-left: 3px solid var(--color-primary);
  color: var(--color-text);
}
.pillar-cards__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.pillar-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: 4px;
  text-decoration: none;
  color: var(--color-text);
  background: #fff;
  transition: box-shadow .2s, background .2s;
}
.pillar-card:hover {
  box-shadow: var(--shadow-md);
  background: var(--color-primary-bg);
  text-decoration: none;
}
.pillar-card__icon {
  display: inline-block;
  font-size: 18px;
  margin-right: 6px;
  vertical-align: middle;
}
.pillar-card__cat {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-bg);
  padding: 1px 8px;
  border-radius: 3px;
  vertical-align: middle;
}
.pillar-card__title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  margin-top: 4px;
}
.pillar-card__desc {
  display: block;
  font-size: 12px;
  color: var(--color-text-light);
  line-height: 1.5;
  margin-top: 4px;
}
.section-heading {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-left: 12px;
  border-left: 3px solid var(--color-primary);
  color: var(--color-text);
}

@media (min-width: 768px) {
  .pillar-cards { margin: 32px 0 40px; }
  .pillar-cards__heading { font-size: 18px; }
  .pillar-cards__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .pillar-card {
    padding: 20px;
    border-left-width: 4px;
  }
  .pillar-card__icon {
    display: block;
    font-size: 24px;
    margin: 0 0 6px;
  }
  .pillar-card__cat {
    font-size: 11px;
    padding: 2px 10px;
  }
  .pillar-card__title {
    display: block;
    font-size: 15px;
    margin-top: 6px;
  }
  .pillar-card__desc {
    margin-top: 6px;
    font-size: 12px;
  }
  .section-heading { font-size: 18px; }
}
@media (min-width: 1024px) {
  .pillar-cards__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 10. Sidebar
 *==================================*/
.widget {
  margin-bottom: 24px;
}
.widget-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-primary);
}

/* 11. Pagination
 *==================================*/
.pagination {
  margin-top: 32px;
  display: flex;
  justify-content: center;
  gap: 4px;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  transition: all .2s;
}
.pagination a:hover {
  background: var(--color-primary-bg);
  border-color: var(--color-primary);
  text-decoration: none;
}
.pagination .current {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* 12. Footer
 *==================================*/
.site-footer {
  background: linear-gradient(to bottom, #2d3748, #1a202c);
  color: rgba(255,255,255,.7);
  padding: 32px 16px;
}
.footer-inner {
  max-width: 800px;
  margin: 0 auto;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  margin-bottom: 20px;
}
.footer-nav li {
  list-style: none;
}
.footer-nav a {
  font-size: 12px;
  color: rgba(255,255,255,.7);
  transition: color .2s;
}
.footer-nav a:hover {
  color: #fff;
  text-decoration: none;
}
.footer-disclaimer {
  font-size: 11px;
  line-height: 1.6;
  margin-bottom: 20px;
  color: rgba(255,255,255,.5);
}
.footer-copyright {
  font-size: 11px;
  text-align: center;
  color: rgba(255,255,255,.4);
}

@media (min-width: 768px) {
  .site-footer { padding: 40px 24px; }
}

/* 13. 404 Page
 *==================================*/
.error-404 {
  text-align: center;
  padding: 60px 0;
}
.error-404 h1 {
  font-size: 48px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
}
.error-404 p {
  font-size: 15px;
  color: var(--color-text-light);
  margin-bottom: 24px;
}
.btn-primary {
  display: inline-block;
  padding: 12px 28px;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  transition: background .2s;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  text-decoration: none;
  color: #fff;
}

/* 14. Search Form
 *==================================*/
.search-form {
  display: flex;
  gap: 0;
}
.search-form input[type="search"] {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: 4px 0 0 4px;
  font-family: var(--font-family-base);
}
.search-form button {
  padding: 8px 16px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-family-base);
}

/* 15. Scroll-to-Top Button
 *==================================*/
.scroll-to-top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 1001;
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: opacity .25s, visibility .25s, transform .25s, background .2s;
}
.scroll-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-to-top:active {
  background: var(--color-primary-dark);
}

@media (min-width: 768px) {
  .scroll-to-top { display: none; }
}

/* 16. Utility
 *==================================*/
.screen-reader-text {
  border: 0;
  clip: rect(1px,1px,1px,1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}
