/**
 * Gutenbergブロック用スタイル
 * SWELL依存を解消し、標準的なブロックエディターのスタイルを提供
 */

/* ========================================
   基本設定
======================================== */
.entry-content,
.post-content,
.page-content {
    max-width: 100%;
    margin: 0 auto;
}

/* ========================================
   画像ブロック (wp:image)
======================================== */
.wp-block-image {
    margin: 2em 0;
}

.wp-block-image img {
    max-width: 100%;
    height: auto;
    display: block;
}

.wp-block-image.alignleft {
    float: left;
    margin-right: 2em;
    margin-bottom: 1em;
}

.wp-block-image.alignright {
    float: right;
    margin-left: 2em;
    margin-bottom: 1em;
}

.wp-block-image.aligncenter {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.wp-block-image.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
}

.wp-block-image.alignwide {
    max-width: calc(100% + 4em);
    margin-left: -2em;
    margin-right: -2em;
}

.wp-block-image figcaption {
    margin-top: 0.5em;
    font-size: 0.9em;
    color: #666;
    text-align: center;
}

/* ========================================
   段落ブロック (wp:paragraph)
======================================== */
.wp-block-paragraph {
    margin-bottom: 1.5em;
    line-height: 1.8;
}

p.has-text-color {
    color: inherit;
}

p.has-background {
    padding: 1.25em 2em;
}

/* テキスト配置 */
.has-text-align-left {
    text-align: left;
}

.has-text-align-center {
    text-align: center;
}

.has-text-align-right {
    text-align: right;
}

/* ========================================
   見出しブロック (wp:heading)
======================================== */
.wp-block-heading {
    margin-top: 2em;
    margin-bottom: 1em;
    line-height: 1.4;
}

/* ========================================
   リストブロック (wp:list)
======================================== */
.wp-block-list {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.wp-block-list li {
    margin-bottom: 0.5em;
    line-height: 1.8;
}

/* ========================================
   引用ブロック (wp:quote)
======================================== */
.wp-block-quote {
    margin: 2em 0;
    padding: 1em 2em;
    border-left: 4px solid #ccc;
    background-color: #f9f9f9;
}

.wp-block-quote p {
    margin-bottom: 1em;
}

.wp-block-quote cite {
    display: block;
    margin-top: 1em;
    font-size: 0.9em;
    color: #666;
    font-style: normal;
}

/* ========================================
   メディアとテキストブロック (wp:media-text)
======================================== */
.wp-block-media-text {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2em;
    align-items: center;
    margin: 2em 0;
}

.wp-block-media-text__media {
    margin: 0;
}

.wp-block-media-text__media img {
    width: 100%;
    height: auto;
    display: block;
}

.wp-block-media-text__content {
    padding: 1em;
}

.wp-block-media-text.has-media-on-the-right {
    grid-template-columns: 1fr 1fr;
    direction: rtl;
}

.wp-block-media-text.has-media-on-the-right > * {
    direction: ltr;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .wp-block-media-text {
        grid-template-columns: 1fr;
    }
    
    .wp-block-media-text.has-media-on-the-right {
        direction: ltr;
    }
    
    .wp-block-media-text__media {
        margin-bottom: 1em;
    }
}

/* ========================================
   グループブロック (wp:group)
======================================== */
.wp-block-group {
    margin: 2em 0;
    padding: 2em;
}

.wp-block-group.has-background {
    padding: 2em;
}

.wp-block-group__inner-container {
    max-width: 100%;
}

/* ========================================
   カラムブロック (wp:columns)
======================================== */
.wp-block-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 2em;
    margin: 2em 0;
}

.wp-block-column {
    flex: 1;
    min-width: 0;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .wp-block-columns {
        display: block;
    }
    
    .wp-block-column {
        margin-bottom: 2em;
    }
    
    .wp-block-column:last-child {
        margin-bottom: 0;
    }
}

/* ========================================
   ボタンブロック (wp:button)
======================================== */
.wp-block-button {
    margin: 1.5em 0;
}

.wp-block-button__link {
    display: inline-block;
    padding: 0.75em 1.5em;
    background-color: #007cba;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.wp-block-button__link:hover {
    background-color: #005a87;
    color: #fff;
}

.wp-block-button.aligncenter {
    text-align: center;
}

.wp-block-button.alignleft {
    text-align: left;
}

.wp-block-button.alignright {
    text-align: right;
}

/* ========================================
   区切り線ブロック (wp:separator)
======================================== */
.wp-block-separator {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 2em auto;
    max-width: 100px;
}

.wp-block-separator.is-style-wide {
    max-width: 100%;
}

.wp-block-separator.is-style-dots {
    border: none;
    text-align: center;
    max-width: none;
    line-height: 1;
    height: auto;
}

.wp-block-separator.is-style-dots::before {
    content: "···";
    font-size: 2em;
    letter-spacing: 0.5em;
    padding-left: 0.5em;
}

/* ========================================
   スペーサーブロック (wp:spacer)
======================================== */
.wp-block-spacer {
    clear: both;
}

/* ========================================
   埋め込みブロック (wp:embed)
======================================== */
.wp-block-embed {
    margin: 2em 0;
}

.wp-block-embed__wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.wp-block-embed__wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ========================================
   カスタムHTMLブロック (wp:html)
======================================== */
.wp-block-html {
    margin: 2em 0;
}

/* ========================================
   カバーブロック (wp:cover)
======================================== */
.wp-block-cover {
    position: relative;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    margin: 2em 0;
    padding: 2em;
}

.wp-block-cover__inner-container {
    position: relative;
    z-index: 1;
    color: #fff;
    text-align: center;
    max-width: 800px;
}

.wp-block-cover.has-background-dim::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 0;
}

/* ========================================
   ギャラリーブロック (wp:gallery)
======================================== */
.wp-block-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1em;
    margin: 2em 0;
}

.wp-block-gallery .wp-block-image {
    margin: 0;
}

.wp-block-gallery.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.wp-block-gallery.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.wp-block-gallery.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .wp-block-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   検索ブロック (wp:search)
======================================== */
.wp-block-search {
    margin: 2em 0;
}

.wp-block-search__inside-wrapper {
    display: flex;
    gap: 0.5em;
}

.wp-block-search__input {
    flex: 1;
    padding: 0.5em;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.wp-block-search__button {
    padding: 0.5em 1em;
    background-color: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* ========================================
   カスタムクラス・スタイル
======================================== */
.is-style-rounded img {
    border-radius: 8px;
}

.is-style-shadow {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ========================================
   レスポンシブ調整
======================================== */
@media (max-width: 768px) {
    .wp-block-image.alignleft,
    .wp-block-image.alignright {
        float: none;
        margin-left: auto;
        margin-right: auto;
    }
    
    .wp-block-image.alignwide {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

/* ========================================
   エディタースタイルとの互換性
======================================== */
.editor-styles-wrapper .wp-block {
    max-width: 100%;
}

/* ========================================
   カラーパレット対応
======================================== */
.has-pale-pink-background-color {
    background-color: #f78da7;
}

.has-vivid-red-background-color {
    background-color: #cf2e2e;
}

.has-luminous-vivid-orange-background-color {
    background-color: #ff6900;
}

.has-luminous-vivid-amber-background-color {
    background-color: #fcb900;
}

.has-light-green-cyan-background-color {
    background-color: #7bdcb5;
}

.has-vivid-green-cyan-background-color {
    background-color: #00d084;
}

.has-pale-cyan-blue-background-color {
    background-color: #8ed1fc;
}

.has-vivid-cyan-blue-background-color {
    background-color: #0693e3;
}

.has-vivid-purple-background-color {
    background-color: #9b51e0;
}