/*
Theme Name: CodePaw Works
Theme URI: https://codepawworks.com
Author: CodePaw Works
Author URI: https://codepawworks.com
Description: A modern, playful corporate website theme with dark mode and neon lime green accents. Features digital matrix-style background with cat paw prints.
Version: 2.3.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: codepaw-works
Tags: dark-mode, modern, corporate, minimalist, custom-menu, featured-images, threaded-comments, translation-ready
*/

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

html, body {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Baloo 2', 'M PLUS Rounded 1c', cursive, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    position: relative;
    overflow-x: hidden;
}

:root {
    --bg: #0b0b0c;
    --text: #f4f5f6;
    --accent: #20b8cf;
    --panel: #131315;
    --muted: #b9bfc6;
    --border: #1f2226;
    --font-cute: 'Baloo 2', 'M PLUS Rounded 1c', cursive;
    --paw-brown: #c49a6c; /* キャラメルブラウン */
}

/* Background Pattern - Matrix Code */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(32, 184, 207, 0.03) 0px,
            transparent 1px,
            transparent 2px,
            rgba(32, 184, 207, 0.03) 3px
        );
    background-size: 100% 100%;
    background-repeat: repeat;
    background-position: 0 0;
    opacity: 1;
    pointer-events: none;
    z-index: -1; /* 背面レイヤーに配置 */
    animation: matrixFlow 20s linear infinite;
}

@keyframes matrixFlow {
    0% { transform: translateY(0); }
    100% { transform: translateY(100px); }
}

#page {
    position: relative;
    z-index: 1; /* body::before (-1) より前面、header (9999) より背面 */
}

/* ====== Header ====== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(16px, 2vw + 8px, 28px) clamp(20px, 5vw, 64px);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000; /* 最前面に配置（.entry-headerやその他の要素より確実に上） */
    border-bottom: 1px solid rgba(32, 184, 207, 0.1);
    /* ヘッダー全体でフォントを統一 */
    font-family: 'Baloo 2', 'M PLUS Rounded 1c', cursive, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: clamp(18px, 2.5vw, 24px);
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.5px;
    /* ヘッダー全体と統一されたフォント */
    font-family: inherit;
    transition: opacity 0.2s ease;
    position: relative; /* スタッキングコンテキストを確立 */
    z-index: 10001; /* ヘッダー（10000）より前面でクリック可能 */
}

.brand:hover {
    opacity: 0.8;
}

.brand:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Logo image next to brand text on desktop */
.brand-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

/* Mobile: Hide text and show only enlarged image */
@media (max-width: 768px) {
    .brand {
        justify-content: center; /* Center the logo on mobile */
    }
    
    .brand h1,
    .brand span,
    .brand .paw-icon {
        display: none; /* Hide text on mobile */
    }
    
    .brand-logo {
        width: 80px;
        height: 80px;
        margin: 0 auto;
    }
}

/* .brand is now an <a> tag, so nested <a> styles are no longer needed */
.brand h1,
.brand span {
    color: inherit;
    margin: 0;
}

.brand .paw-icon {
    font-size: 1.2em;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
    animation: pawGlow 2s ease-in-out infinite alternate;
}

@keyframes pawGlow {
    from { 
        text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
        opacity: 0.8;
    }
    to { 
        text-shadow: 0 0 15px var(--accent), 0 0 30px var(--accent), 0 0 40px var(--accent);
        opacity: 1;
    }
}

nav {
    display: flex;
    gap: clamp(16px, 2.5vw, 32px);
    position: relative; /* スタッキングコンテキストを確立 */
    z-index: 10001; /* ヘッダー（10000）より前面でクリック可能 */
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: clamp(16px, 2.5vw, 32px);
}

nav li {
    margin: 0;
}

nav a {
    color: var(--text);
    text-decoration: none;
    font-size: clamp(14px, 1.5vw, 16px);
    transition: color 0.3s ease, text-shadow 0.3s ease;
    position: relative;
    /* ヘッダー全体と統一されたフォント */
    font-family: inherit;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    transition: width 0.3s ease;
}

nav a:hover {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

nav a:hover::after {
    width: 100%;
}

/* ====== Main Content Area ====== */
/* For pages and posts - add padding to account for fixed header */
.site-main {
    padding-top: clamp(100px, 12vw, 120px); /* Account for fixed header */
    min-height: calc(100vh - clamp(100px, 12vw, 120px));
    position: relative; /* スタッキングコンテキストを確立 */
    z-index: 1; /* ヘッダー（10000）より背面 */
}

/* Page and Post Content Styling */
article {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(40px, 6vw, 80px) clamp(20px, 5vw, 64px);
    background: var(--panel);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative; /* スタッキングコンテキストを確立 */
    z-index: 1; /* ヘッダー（10000）より背面 */
}

.entry-header {
    position: static; /* レイアウトに影響しないようにstaticに設定 */
    z-index: auto; /* z-indexをリセット */
    margin-bottom: clamp(24px, 4vw, 40px);
    text-align: center;
    pointer-events: none; /* クリックイベントを無効化（ヘッダーに被さらないように） */
}

/* .entry-header内の要素はクリック可能にする */
.entry-header * {
    pointer-events: auto;
}

.entry-title {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
}

.entry-content {
    font-size: clamp(16px, 2vw, 18px);
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
}

.entry-content h2 {
    font-size: clamp(24px, 3.5vw, 32px);
    font-weight: 700;
    color: var(--text);
    margin-top: clamp(32px, 5vw, 48px);
    margin-bottom: clamp(16px, 2.5vw, 24px);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent);
}

.entry-content h3 {
    font-size: clamp(20px, 2.5vw, 24px);
    font-weight: 600;
    color: var(--text);
    margin-top: clamp(24px, 4vw, 32px);
    margin-bottom: clamp(12px, 2vw, 16px);
}

.entry-content p {
    margin-bottom: clamp(16px, 2.5vw, 24px);
}

.entry-content ul,
.entry-content ol {
    margin: clamp(16px, 2.5vw, 24px) 0;
    padding-left: clamp(24px, 4vw, 32px);
}

.entry-content li {
    margin-bottom: clamp(8px, 1.5vw, 12px);
}

.entry-content a {
    color: var(--accent);
    text-decoration: underline;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.entry-content a:hover {
    color: #4dd0e1;
    text-shadow: 0 0 8px rgba(77, 208, 225, 0.5);
}

/* ====== Hero Section ====== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: clamp(120px, 15vw, 200px) clamp(20px, 5vw, 64px) clamp(80px, 10vw, 120px);
    position: relative;
}

.hero h1:not(.hero-title-text) {
    font-size: clamp(32px, 8vw, 72px);
    font-weight: 900;
    color: var(--text);
    margin-bottom: clamp(16px, 3vw, 24px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-shadow: 
        0 0 20px rgba(255, 255, 255, 0.3),
        0 0 40px rgba(32, 184, 207, 0.2);
    text-transform: uppercase;
}

/* Hero Title Text - CODE PAW WORKS (2行構成) */
.hero .hero-title-text,
.hero-title-text {
    font-family: 'Baloo 2', cursive, sans-serif;
    font-weight: 800 !important;
    color: #c49a6c !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: clamp(4px, 0.8vw, 10px) !important;
    text-align: center !important;
    text-transform: none !important;
    position: relative !important;
}

/* 上段：CODE PAW（補助的・少し小さめ） */
.hero-title-top {
    font-size: clamp(48px, 6.5vw, 96px) !important;
    letter-spacing: 0.08em !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    opacity: 0.85;
    display: block;
    line-height: 1;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
}

/* 下段：WORKS（主役・大きく） */
.hero-title-bottom {
    font-size: clamp(72px, 10vw, 140px) !important;
    letter-spacing: 0.05em !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    display: block;
    line-height: 1;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
}

/* Hover効果 - 軽く浮く＋影が濃くなる */
.hero-title-text:hover .hero-title-top,
.hero-title-text:hover .hero-title-bottom {
    transform: translateY(-2px);
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

/* 装飾アイコン（犬猫が顔を出す演出） */
.hero-title-decoration {
    position: absolute;
    width: clamp(40px, 5vw, 60px);
    height: clamp(40px, 5vw, 60px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s ease;
    pointer-events: none;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 10;
}

/* 左側：ビーグル犬 */
.hero-title-decoration-left {
    left: clamp(-60px, -10vw, -80px);
    top: 50%;
    transform: translateY(-45%) translateX(-20px) scale(0.7);
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}

/* 右側：犬（PAWのAに被るように表示） */
.hero-title-decoration-right {
    right: clamp(5px, 4vw, 45px);
    top: clamp(14px, 3.25vw, 38px);
    width: clamp(90px, 12vw, 160px) !important;
    height: clamp(90px, 12vw, 160px) !important;
    transform: translateY(-50%) translateX(20px) scale(0.7);
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
    background-image: url('/wp-content/themes/codepaw-works/assets/img/wanko.png') !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

/* Hover時：左右から顔を出す */
.hero-title-text:hover .hero-title-decoration {
    opacity: 1 !important;
}

.hero-title-text:hover .hero-title-decoration-left {
    transform: translateY(-50%) translateX(0) scale(1);
}

.hero-title-text:hover .hero-title-decoration-right {
    transform: translateY(-55%) translateX(0) scale(1);
}

/* スマホでは控えめ or 非表示 */
@media (max-width: 768px) {
    .hero-title-decoration {
        opacity: 0 !important;
        display: none;
    }
}

@keyframes gentleBounce {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(-2deg);
    }
    75% {
        transform: translateY(-4px) rotate(1deg);
    }
}

.hero .subtitle {
    font-size: clamp(18px, 3vw, 28px);
    color: var(--text);
    margin-bottom: clamp(32px, 5vw, 48px);
    opacity: 0.9;
}

.hero .btn {
    display: inline-block;
    background: var(--accent);
    color: var(--bg);
    padding: clamp(14px, 2vw, 18px) clamp(32px, 5vw, 48px);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: clamp(16px, 2vw, 20px);
    box-shadow: 
        0 0 20px rgba(32, 184, 207, 0.5),
        0 0 40px rgba(32, 184, 207, 0.3),
        0 0 60px rgba(32, 184, 207, 0.1);
    transition: all 0.3s ease;
    border: 2px solid var(--accent);
}

.hero .btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 0 30px rgba(32, 184, 207, 0.7),
        0 0 60px rgba(32, 184, 207, 0.5),
        0 0 90px rgba(32, 184, 207, 0.3);
}

/* ====== Services Section ====== */
.services {
    padding: clamp(80px, 12vw, 120px) clamp(20px, 5vw, 64px);
    background: rgba(0, 0, 0, 0.5);
}

.services h2 {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    color: var(--text);
    text-align: center;
    margin-bottom: clamp(48px, 8vw, 64px);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(24px, 4vw, 32px);
    max-width: 1200px;
    margin: 0 auto;
}

.service-card {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: clamp(24px, 4vw, 32px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.service-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 
        0 0 20px rgba(32, 184, 207, 0.3),
        0 0 40px rgba(32, 184, 207, 0.1);
}

.service-card:hover::before {
    opacity: 1;
    border-color: var(--accent);
    box-shadow: 
        inset 0 0 20px rgba(32, 184, 207, 0.1),
        0 0 30px rgba(32, 184, 207, 0.2);
}

.service-icon {
    font-size: clamp(32px, 5vw, 48px);
    color: var(--accent);
    margin-bottom: clamp(16px, 3vw, 24px);
    text-shadow: 0 0 10px var(--accent);
    display: block;
    line-height: 1;
}

.service-icon-img {
    width: 100%;
    max-width: clamp(200px, 30vw, 300px);
    height: auto;
    display: block;
    margin: 0 auto;
    /* 透過PNGの透明部分を正しく表示（背景は透明のまま） */
    background: transparent;
    /* 透過を正しく処理 */
    /* 画像の品質を保持 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* ホバー時のエフェクト（オプション） */
    transition: transform 0.3s ease, filter 0.3s ease;
}

.service-card:hover .service-icon-img {
    transform: scale(1.05);
    filter: drop-shadow(0 0 15px rgba(32, 184, 207, 0.4));
}

.service-card h3 {
    font-size: clamp(20px, 3vw, 24px);
    font-weight: 700;
    color: var(--text);
    margin-bottom: clamp(12px, 2vw, 16px);
}

.service-card p {
    font-size: clamp(14px, 2vw, 16px);
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

/* ====== About Section ====== */
.about {
    padding: clamp(80px, 12vw, 120px) clamp(20px, 5vw, 64px);
    background: rgba(0, 0, 0, 0.3);
}

.about h2 {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    color: var(--text);
    text-align: center;
    margin-bottom: clamp(48px, 8vw, 64px);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: clamp(32px, 5vw, 48px);
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
}

.about-text {
    font-size: clamp(18px, 3vw, 22px);
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.8;
    text-align: center;
}

.about-text p {
    margin-bottom: clamp(16px, 3vw, 24px);
}


/* ====== Logbook Section ====== */
.logbook {
    padding: clamp(80px, 12vw, 120px) clamp(20px, 5vw, 64px);
    background: rgba(0, 0, 0, 0.3);
}

.logbook h2 {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    color: var(--text);
    text-align: center;
    margin-bottom: clamp(48px, 8vw, 64px);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.logbook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: clamp(24px, 4vw, 32px);
    max-width: 1200px;
    margin: 0 auto;
}

.logbook-card {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: clamp(24px, 4vw, 32px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.logbook-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 
        0 0 20px rgba(32, 184, 207, 0.3),
        0 0 40px rgba(32, 184, 207, 0.1);
}

.logbook-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.logbook-card h3 {
    font-size: clamp(20px, 3vw, 24px);
    font-weight: 700;
    color: var(--text);
    margin-bottom: clamp(12px, 2vw, 16px);
    transition: color 0.3s ease;
}

.logbook-card:hover h3 {
    color: var(--accent);
}

.logbook-meta {
    font-size: clamp(12px, 1.5vw, 14px);
    color: var(--muted);
    margin-bottom: clamp(12px, 2vw, 16px);
}

.logbook-excerpt {
    font-size: clamp(14px, 2vw, 16px);
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin: 0;
}

.logbook-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    font-size: clamp(16px, 2vw, 18px);
    padding: clamp(40px, 6vw, 60px);
}

.logbook-coming-soon {
    grid-column: 1 / -1;
    text-align: center;
    padding: clamp(60px, 8vw, 100px);
    pointer-events: none; /* リンクを無効化 */
}

.logbook-message {
    font-size: clamp(20px, 3vw, 28px);
    color: var(--text);
    font-weight: 500;
    letter-spacing: 0.5px;
    margin: 0;
    opacity: 0.8;
}

/* ====== SNS Section ====== */
.sns {
    padding: clamp(80px, 12vw, 120px) clamp(20px, 5vw, 64px);
    background: rgba(0, 0, 0, 0.5);
}

.sns h2 {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    color: var(--text);
    text-align: center;
    margin-bottom: clamp(48px, 8vw, 64px);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.sns-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.sns-link {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    padding: clamp(16px, 2.5vw, 24px) clamp(32px, 5vw, 48px);
    background: var(--panel);
    border: 2px solid var(--accent);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 
        0 0 20px rgba(32, 184, 207, 0.3),
        0 0 40px rgba(32, 184, 207, 0.1);
}

.sns-link:hover {
    transform: translateY(-4px);
    background: rgba(32, 184, 207, 0.1);
    box-shadow: 
        0 0 30px rgba(32, 184, 207, 0.5),
        0 0 60px rgba(32, 184, 207, 0.3);
}

.sns-icon {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

.sns-text {
    color: var(--text);
}

/* ====== Footer ====== */
footer {
    padding: clamp(32px, 5vw, 48px) clamp(20px, 5vw, 64px);
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: clamp(14px, 2vw, 16px);
    border-top: 1px solid rgba(32, 184, 207, 0.1);
    background: rgba(0, 0, 0, 0.8);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

.footer-content p {
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
}

.footer-nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-nav a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: clamp(14px, 2vw, 16px);
    transition: opacity 0.2s ease, color 0.2s ease;
}

.footer-nav a:hover {
    opacity: 1;
    color: var(--accent);
    text-decoration: underline;
}

@media (min-width: 768px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* ====== Responsive Design ====== */
@media (max-width: 768px) {
    header {
        flex-wrap: nowrap;
    }

    nav ul {
        flex-direction: row;
        gap: 16px;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .logbook-grid {
        grid-template-columns: 1fr;
    }
}

/* Accessibility */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* Smooth scrolling */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
