/**
 * Forgeee Theme Main Stylesheet
 * 
 * @package Forgeee
 * @since 1.0.0
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Use CSS Variables from theme options */
body {
    font-family: var(--fg-font-family-body);
    font-size: var(--fg-font-size-base);
    line-height: var(--fg-line-height-base);
    color: var(--fg-text-color);
    background-color: #fff;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--fg-font-family-heading);
    line-height: 1.2;
    margin-bottom: 1rem;
}

a {
    color: var(--fg-link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--fg-link-hover-color);
}

/* Container */
.container {
    max-width: var(--fg-container-width);
    margin: 0 auto;
    padding-left: var(--fg-padding-horizontal);
    padding-right: var(--fg-padding-horizontal);
}

/* Site Layout */
.site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-content {
    flex: 1;
    padding-top: var(--fg-margin-top);
    padding-bottom: var(--fg-margin-bottom);
}

/* Header */
.site-header {
    background-color: var(--fg-header-bg-color);
    color: var(--fg-header-text-color);
    min-height: var(--fg-header-height);
}

/* Footer */
.site-footer {
    padding: var(--fg-padding-vertical) 0;
}

/* Header */
.site-header {
    background-color: var(--fg-header-bg-color);
    color: var(--fg-header-text-color);
    min-height: var(--fg-header-height);
    border-bottom: 1px solid #eee;
}

.site-header.sticky {
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.site-branding {
    flex-shrink: 0;
}

.site-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.site-title a {
    color: var(--fg-header-text-color);
}

.site-description {
    margin: 5px 0 0;
    font-size: 14px;
    opacity: 0.7;
}

.site-logo {
    max-height: 60px;
    width: auto;
}

/* Navigation */
.main-navigation {
    flex-grow: 1;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 30px;
}

.main-navigation a {
    color: var(--fg-header-text-color);
    font-weight: 500;
    padding: 5px 0;
    position: relative;
    transition: color 0.3s ease;
}

.main-navigation a:hover {
    color: var(--fg-primary-color);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.menu-toggle-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-toggle-inner span {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--fg-header-text-color);
    transition: all 0.3s ease;
}

.menu-toggle.is-active .menu-toggle-inner span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.is-active .menu-toggle-inner span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active .menu-toggle-inner span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.menu-toggle-text {
    display: none;
}

/* Search */
.header-search {
    position: relative;
}

.search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    color: var(--fg-header-text-color);
}

.search-form-wrapper {
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: none;
    min-width: 300px;
    z-index: 100;
}

.search-form-wrapper.active {
    display: block;
}

.search-form input[type="search"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    left: -9999px;
}

.skip-link:focus {
    position: absolute;
    left: 6px;
    top: 7px;
    z-index: 999999;
    padding: 8px 16px;
    background-color: var(--fg-primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}

/* ========================================
   Single Post Content Area
   ======================================== */
.fg-content--single {
    padding-top: 40px;
}

/* ========================================
   Page Content Area
   ======================================== */
.fg-content--page {
    padding-top: 40px;
}

/* ========================================
   Page Header (Single & Page)
   ======================================== */
.fg-page-header--single,
.fg-page-header--page {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* ========================================
   Single Post Entry Header
   ======================================== */
.fg-entry-header {
    margin-bottom: 2rem;
}

/* Category */
.fg-entry-categories {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fg-category-link {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background-color: transparent;
    color: var(--fg-primary-color, #1297b0);
    text-decoration: none;
    font-weight: 500;
    font-size: 10px;
    border: 1px solid var(--fg-primary-color, #1297b0);
    border-radius: 12px;
    transition: all 0.3s ease;
    line-height: 1.4;
}

.fg-category-link:hover {
    background-color: var(--fg-primary-color, #1297b0);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(18, 151, 176, 0.3);
}

.fg-category-separator {
    display: none;
}

/* Title */
.fg-entry-title {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 1.25rem;
    color: var(--fg-text-color, #333);
    letter-spacing: -0.02em;
}

@media (max-width: 768px) {
    .fg-entry-title {
        font-size: 1.875rem;
    }
}

@media (max-width: 480px) {
    .fg-entry-title {
        font-size: 1.5rem;
    }
}

/* Tags */
.fg-entry-tags {
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.6;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fg-tag-link {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.fg-tag-link:hover {
    color: var(--fg-primary-color, #1297b0);
    text-decoration: underline;
}

/* Published Date */
/* Entry Meta Row (Date + Share Buttons) */
.fg-entry-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.fg-entry-date {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.5;
    flex-shrink: 0;
}

.fg-entry-date time {
    color: inherit;
}

/* Entry Share Buttons (Inline) */
.fg-entry-share {
    margin-left: auto;
    flex-shrink: 0;
}

.fg-entry-share .fg-share-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fg-entry-share .fg-share-label {
    display: none; /* ラベルを非表示（コンパクトに） */
}

.fg-entry-share .fg-share-buttons-list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fg-entry-share .fg-share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: transparent;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.fg-entry-share .fg-share-button:hover {
    transform: translateY(-2px);
    opacity: 0.8;
}

.fg-entry-share .fg-share-button--x {
    color: #000;
}

.fg-entry-share .fg-share-button--x:hover {
    color: #333;
}

.fg-entry-share .fg-share-button--facebook {
    color: #1877f2;
}

.fg-entry-share .fg-share-button--facebook:hover {
    color: #166fe5;
}

.fg-entry-share .fg-share-button--line {
    color: #06c755;
}

.fg-entry-share .fg-share-button--line:hover {
    color: #05b84a;
}

.fg-entry-share .fg-share-button--hatena {
    color: #00a4de;
}

.fg-entry-share .fg-share-button--hatena:hover {
    color: #0093c7;
}

.fg-entry-share .fg-share-button--linkedin {
    color: #0077b5;
}

.fg-entry-share .fg-share-button--linkedin:hover {
    color: #006699;
}

.fg-entry-share .fg-share-button--pinterest {
    color: #bd081c;
}

.fg-entry-share .fg-share-button--pinterest:hover {
    color: #a00616;
}

.fg-entry-share .fg-share-button--copy {
    background-color: #666;
    color: #fff;
    border-color: #666;
    cursor: pointer;
}

.fg-entry-share .fg-share-button--copy:hover {
    background-color: #555;
    border-color: #555;
}

.fg-entry-share .fg-share-button--copy.copied {
    background-color: #4caf50;
    border-color: #4caf50;
}

.fg-entry-share .fg-share-icon,
.fg-entry-share .fg-share-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    stroke: currentColor;
    display: block;
    flex-shrink: 0;
}

.fg-entry-share .fg-share-button svg {
    width: 100%;
    height: 100%;
}

/* SVGアイコンの色をボタンの色に合わせる */
.fg-entry-share .fg-share-button svg path,
.fg-entry-share .fg-share-button svg polygon,
.fg-entry-share .fg-share-button svg rect,
.fg-entry-share .fg-share-button svg ellipse,
.fg-entry-share .fg-share-button svg circle,
.fg-entry-share .fg-share-button svg g path,
.fg-entry-share .fg-share-button svg g polygon,
.fg-entry-share .fg-share-button svg g rect,
.fg-entry-share .fg-share-button svg g ellipse,
.fg-entry-share .fg-share-button svg g circle {
    fill: currentColor;
    stroke: currentColor;
}

/* 各サービスのアイコン色を直接設定（インラインスタイルを上書き） */
/* fill:none の要素は fill を変更せず、stroke のみ変更 */
.fg-entry-share .fg-share-button--x svg * {
    stroke: #000 !important;
}

.fg-entry-share .fg-share-button--x svg *[fill]:not([fill="none"]) {
    fill: #000 !important;
}

.fg-entry-share .fg-share-button--facebook svg * {
    stroke: #1877f2 !important;
}

.fg-entry-share .fg-share-button--facebook svg *[fill]:not([fill="none"]) {
    fill: #1877f2 !important;
}

.fg-entry-share .fg-share-button--line svg * {
    stroke: #06c755 !important;
}

.fg-entry-share .fg-share-button--line svg *[fill]:not([fill="none"]) {
    fill: #06c755 !important;
}

.fg-entry-share .fg-share-button--hatena svg * {
    stroke: #00a4de !important;
}

.fg-entry-share .fg-share-button--hatena svg *[fill]:not([fill="none"]) {
    fill: #00a4de !important;
}

.fg-entry-share .fg-share-button--linkedin svg * {
    stroke: #0077b5 !important;
}

.fg-entry-share .fg-share-button--linkedin svg *[fill]:not([fill="none"]) {
    fill: #0077b5 !important;
}

.fg-entry-share .fg-share-button--pinterest svg * {
    stroke: #bd081c !important;
}

.fg-entry-share .fg-share-button--pinterest svg *[fill]:not([fill="none"]) {
    fill: #bd081c !important;
}

/* ホバー時の色変更 */
.fg-entry-share .fg-share-button--x:hover svg * {
    stroke: #333 !important;
}

.fg-entry-share .fg-share-button--x:hover svg *[fill]:not([fill="none"]) {
    fill: #333 !important;
}

.fg-entry-share .fg-share-button--facebook:hover svg * {
    stroke: #166fe5 !important;
}

.fg-entry-share .fg-share-button--facebook:hover svg *[fill]:not([fill="none"]) {
    fill: #166fe5 !important;
}

.fg-entry-share .fg-share-button--line:hover svg * {
    stroke: #05b84a !important;
}

.fg-entry-share .fg-share-button--line:hover svg *[fill]:not([fill="none"]) {
    fill: #05b84a !important;
}

.fg-entry-share .fg-share-button--hatena:hover svg * {
    stroke: #0093c7 !important;
}

.fg-entry-share .fg-share-button--hatena:hover svg *[fill]:not([fill="none"]) {
    fill: #0093c7 !important;
}

.fg-entry-share .fg-share-button--linkedin:hover svg * {
    stroke: #006699 !important;
}

.fg-entry-share .fg-share-button--linkedin:hover svg *[fill]:not([fill="none"]) {
    fill: #006699 !important;
}

.fg-entry-share .fg-share-button--pinterest:hover svg * {
    stroke: #a00616 !important;
}

.fg-entry-share .fg-share-button--pinterest:hover svg *[fill]:not([fill="none"]) {
    fill: #a00616 !important;
}

.fg-entry-share .fg-share-button .material-icons {
    font-size: 18px;
    line-height: 1;
    width: 18px;
    height: 18px;
    display: block;
}

.fg-entry-share .fg-share-copied {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fg-entry-share .fg-share-button--copy.copied .fg-share-copied {
    opacity: 1;
}

.fg-entry-share .fg-share-button--copy.copied .material-icons {
    opacity: 0;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .fg-entry-meta-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .fg-entry-share {
        margin-left: 0;
        width: 100%;
    }
    
    .fg-entry-share .fg-share-buttons {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Featured Image */
.fg-post-thumbnail {
    border-radius: 8px;
    overflow: hidden;
}

.fg-featured-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Table of Contents */
.fg-toc-wrapper {
    margin: 2rem 0;
    padding: 0.64rem 1.2rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.fg-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
}

.fg-toc-header * {
    pointer-events: none;
}

.fg-toc-toggle {
    pointer-events: auto;
}

.fg-toc-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--fg-text-color, #333);
    line-height: 1.5;
    display: flex;
    align-items: center;
}

.fg-toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: var(--fg-text-color, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.fg-toc-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--fg-primary-color, #1297b0);
}

.fg-toc-icon {
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.fg-toc {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out, margin-top 0.3s ease-out;
}

.fg-toc.fg-toc-open {
    max-height: 2000px;
    opacity: 1;
    margin-top: 1rem;
}

.fg-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fg-toc-item {
    margin: 0.5rem 0;
}

.fg-toc-item--level-2 {
    margin-left: 0;
}

.fg-toc-item--level-3 {
    margin-left: 1.5rem;
}

.fg-toc-item--level-4 {
    margin-left: 3rem;
}

.fg-toc-item--level-5 {
    margin-left: 4.5rem;
}

.fg-toc-item--level-6 {
    margin-left: 6rem;
}

.fg-toc-link {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
    display: block;
    padding: 0.25rem 0;
    line-height: 1.5;
}

.fg-toc-link:hover {
    color: var(--fg-primary-color, #1297b0);
    text-decoration: underline;
}

.fg-toc-sublist {
    list-style: none;
    margin: 0.5rem 0 0 1.5rem;
    padding: 0;
}

@media (max-width: 768px) {
    .fg-toc-wrapper {
        padding: 1rem;
    }
    
    .fg-toc-item--level-3 {
        margin-left: 1rem;
    }
    
    .fg-toc-item--level-4 {
        margin-left: 2rem;
    }
    
    .fg-toc-item--level-5 {
        margin-left: 3rem;
    }
    
    .fg-toc-item--level-6 {
        margin-left: 4rem;
    }
    
    .fg-toc-sublist {
        margin-left: 1rem;
    }
}

/* ========================================
   Breadcrumb Navigation
   ======================================== */
.fg-breadcrumb {
    margin: 0 0 1.5rem;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.fg-breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.fg-breadcrumb-item {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.fg-breadcrumb-item:not(:last-child)::after {
    content: '>';
    margin-left: 0.5rem;
    color: #999;
    font-weight: normal;
}

.fg-breadcrumb-item a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.fg-breadcrumb-item a:hover {
    color: var(--fg-primary-color, #1297b0);
    text-decoration: underline;
}

.fg-breadcrumb-item span {
    color: #333;
    font-weight: 500;
}

/* Screen Reader Text */
.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 !important;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    clip-path: none;
    color: #21759b;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .menu-toggle-text {
        display: inline-block;
        margin-left: 5px;
    }
    
    .main-navigation ul {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--fg-header-bg-color);
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        display: none;
    }
    
    .main-navigation.toggled ul {
        display: flex;
    }
    
    .header-inner {
        flex-wrap: wrap;
    }
    
    .site-header {
        position: relative;
    }
    
    /* Breadcrumb responsive */
    .fg-breadcrumb {
        font-size: 0.8125rem;
    }
    
    .fg-breadcrumb-list {
        gap: 0.375rem;
    }
    
    .fg-breadcrumb-item:not(:last-child)::after {
        margin-left: 0.375rem;
    }
}

/* ========================================
   著者ボックス
   ======================================== */
.fg-author-box {
    margin: 3rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.fg-author-box:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.fg-author-box__inner {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.fg-author-box__avatar {
    flex-shrink: 0;
}

.fg-author-box__avatar-link {
    display: block;
    transition: transform 0.3s ease;
}

.fg-author-box__avatar-link:hover {
    transform: scale(1.05);
}

.fg-author-box__avatar img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fg-author-box__content {
    flex: 1;
    min-width: 0;
}

.fg-author-box__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.fg-author-box__name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
}

.fg-author-box__name a {
    color: var(--fg-text-color, #333);
    text-decoration: none;
    transition: color 0.3s ease;
}

.fg-author-box__name a:hover {
    color: var(--fg-primary-color, #1297b0);
}

.fg-author-box__link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--fg-primary-color, #1297b0);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(18, 151, 176, 0.05);
}

.fg-author-box__link:hover {
    background: rgba(18, 151, 176, 0.1);
    color: var(--fg-primary-color, #1297b0);
    transform: translateX(4px);
}

.fg-author-box__link .material-icons {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.fg-author-box__link:hover .material-icons {
    transform: translateX(2px);
}

.fg-author-box__description {
    color: #666;
    line-height: 1.8;
    font-size: 0.9375rem;
}

.fg-author-box__description p {
    margin: 0 0 0.75rem 0;
}

.fg-author-box__description p:last-child {
    margin-bottom: 0;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .fg-author-box {
        padding: 1.5rem;
    }

    .fg-author-box__inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .fg-author-box__avatar img {
        width: 100px;
        height: 100px;
    }

    .fg-author-box__header {
        flex-direction: column;
        align-items: center;
    }

    .fg-author-box__name {
        font-size: 1.25rem;
    }

    .fg-author-box__content {
        text-align: left;
    }
}