:root {
    --text-main: #111111;
    --bg-base: #ffffff;
}

html {
    scroll-behavior: auto;
}
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    font-family: "Noto Sans JP", sans-serif;
    color: var(--text-main);
    background-color: var(--bg-base);
    overflow-x: hidden;
}

/* Tech Font Utility */
.font-mono-tech {
    font-family: "Roboto Mono", monospace;
    font-optical-sizing: auto;
    font-weight: 600;
}

/* Grid Background */
.bg-grid-tech {
    background-image: radial-gradient(#ccc 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0;
}

/* Layout Utility */
.container-custom {
    max-width: 1240px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Decoration: Crosshair */
.crosshair {
    position: absolute;
    width: 15px;
    height: 15px;
    pointer-events: none;
}
.crosshair::before,
.crosshair::after {
    content: "";
    position: absolute;
    background-color: #000;
}
.crosshair::before {
    top: 7px;
    left: 0;
    width: 15px;
    height: 1px;
}
.crosshair::after {
    top: 0;
    left: 7px;
    width: 1px;
    height: 15px;
}

/* Loader */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-image: radial-gradient(#ccc 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0;
}

/* Custom Progress Bar Style */
.loader-progress-container {
    position: relative;
    width: 240px;
    height: 4px;
    background: #f3f4f6;
    overflow: hidden;
}
.loader-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: #000;
    transition: width 0.1s linear;
}

/* Slider Styles */
.kv-wrapper {
    position: relative;
    width: 100%;
    height: 650px;
    overflow: hidden;
}
@media (max-width: 768px) {
    .kv-wrapper {
        height: auto;
        min-height: 700px;
    }
}

.kv-title-clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-line-clamp: 4; /* スマホは4行で… */
}

@media (min-width: 768px) {
    .kv-title-clamp {
        -webkit-line-clamp: 4; /* PCは5行で… */
    }
}

.kv-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
    z-index: 1;
}
.kv-slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

.kv-content-wrap {
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.6s ease 0.3s;
}
.kv-slide.active .kv-content-wrap {
    transform: translateY(0);
    opacity: 1;
}

/* KV Navigation Buttons */
.kv-nav-btn {
    width: 48px;
    height: 48px;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
    color: #111;
}
.kv-nav-btn:hover {
    border-color: #111;
    background: #111;
    color: white;
    transform: scale(1.05);
}

/* Image Tech Border & Hover Effect */
.img-tech-border {
    position: relative;
    overflow: hidden;
}
.img-tech-border img {
    transition: transform 0.5s cubic-bezier(0.2, 1, 0.3, 1);
}
.group:hover .img-tech-border img {
    transform: scale(1.03);
}

/* Sticky Sidebar */
.sidebar-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 120px;
}

/* Digital Gradient Animation */
.bg-digital-motion {
    background: linear-gradient(125deg, #000000 0%, #0f172a 25%, #1e1b4b 50%, #111827 75%, #000000 100%);
    background-size: 400% 400%;
    animation: digitalFlow 15s ease infinite;
    position: relative;
    overflow: hidden;
}
.bg-digital-motion::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.05) 0%, transparent 50%), radial-gradient(circle, rgba(139, 92, 246, 0.05) 100%, transparent 50%);
    animation: rotateGlow 20s linear infinite;
    pointer-events: none;
}
@keyframes digitalFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}
@keyframes rotateGlow {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* View More Button Styles */
.btn-view-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    border: 1px solid #111;
    border-radius: 9999px;
    background-color: #fff;
    color: #111;
    font-family: "Roboto Mono", monospace;
    font-optical-sizing: auto;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
    text-decoration: none;
    cursor: pointer;
}
.btn-view-more:hover {
    background-color: #111;
    color: #fff;
    padding-right: 1.25rem;
    padding-left: 1.75rem;
}
.btn-view-more svg {
    transition: transform 0.3s ease;
}
.btn-view-more:hover svg {
    transform: translateX(4px);
}

/* KV Image Animation (Floating Vertical Only) */
@keyframes floatVertical {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}
.animate-float {
    animation: floatVertical 6s ease-in-out infinite;
}

/* KV Background Decoration */
.kv-bg-circle {
    position: absolute;
    border-radius: 50%;
    border: 1px dashed #000;
    pointer-events: none;
}

/* MENU Styles */
.menu-link {
    display: block;
    position: relative;
    padding-left: 20px;
    transition: color 0.3s;
}
.menu-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 0;
    height: 2px;
    background-color: #000;
    transition: width 0.3s cubic-bezier(0.2, 1, 0.3, 1);
    transform: translateY(-50%);
}
.menu-link:hover::before {
    width: 12px;
}
.menu-link:hover {
    color: #555;
}

/* Modern Typographic Logo */
.logo-modern-wrap {
    text-decoration: none;
    color: #111;
    display: inline-flex;
    align-items: baseline;
    transition: opacity 0.3s ease;
}
.logo-modern-wrap:hover {
    opacity: 0.6;
}
.header-logo .en {
    font-family: "Noto Sans JP", monospace;
    font-weight: 700;
    font-size: 1.75rem;
    letter-spacing: -0.04em;
    line-height: 1;
}
.header-logo .jp {
    font-family: "Noto Sans JP", sans-serif;
    font-weight: 700;
    font-size: 0.875rem;
    margin-left: 12px;
    letter-spacing: 0.1em;
}
.footer-logo-block {
    display: inline-block;
    text-decoration: none;
    color: #111;
    border-bottom: 2px solid #111;
    padding-bottom: 4px;
    margin-bottom: 24px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.footer-logo-block:hover {
    padding-right: 20px;
}
.footer-logo-block .en {
    display: block;
    font-family: "Noto Sans JP", monospace;
    font-weight: 700;
    font-size: 2.5rem;
    line-height: 0.9;
    letter-spacing: -0.06em;
}
.footer-logo-block .jp {
    display: block;
    font-family: "Noto Sans JP", sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    margin-top: 4px;
    letter-spacing: 0.25em;
    text-align: justify;
    text-align-last: justify;
    width: 100%;
}

/* Loading Modern Text */
.loading-modern-text {
    font-family: "Noto Sans JP", monospace;
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    color: #111;
    opacity: 0;
    animation: simpleFadeIn 1s ease forwards;
}

@keyframes simpleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
/* Article Content (Single) - add this to the end of custom.css */
.article-content {
    position: relative;
    z-index: 1;
    font-size: 1rem;
    line-height: 1.9;
    color: #111;
}
.article-content > *:first-child {
    margin-top: 0;
}
.article-content > *:last-child {
    margin-bottom: 0;
}

.article-content p {
    margin: 1rem 0;
}
.article-content a {
    text-decoration: underline;
    text-underline-offset: 4px;
}
.article-content a:hover {
    opacity: 0.7;
}

.article-content h2,
.article-content h3 {
    font-weight: 700;
    line-height: 1.35;
    margin-top: 2.25rem;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}
.article-content h2 {
    font-size: 1.35rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.6rem;
}
.article-content h3 {
    font-size: 1.125rem;
    position: relative;
    padding-left: 16px;
}
.article-content h3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 10px;
    height: 2px;
    background: #000;
}

.article-content ul,
.article-content ol {
    margin: 1rem 0 1rem 1.25rem;
}
.article-content ul {
    list-style: disc;
}
.article-content ol {
    list-style: decimal;
}
.article-content li {
    margin: 0.4rem 0;
}

.article-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid #111;
    background: #f9fafb;
}

.article-content code {
    font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.95em;
    background: #f3f4f6;
    padding: 0.15em 0.35em;
    border-radius: 4px;
}
.article-content pre {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    overflow: auto;
    background: #0b1220;
    color: #fff;
    border-radius: 8px;
}
.article-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.article-content hr {
    margin: 2rem 0;
    border: 0;
    border-top: 1px solid #e5e7eb;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}
.article-content th,
.article-content td {
    border: 1px solid #e5e7eb;
    padding: 0.75rem 0.9rem;
    vertical-align: top;
}
.article-content th {
    background: #f9fafb;
    font-weight: 700;
}
.article-content img {
    max-width: 100%;
    height: auto;
    margin: 1.25rem 0;
}
/* =========================================================
   Footer theme switch (dark on article pages)
   How to use:
   - Add this CSS to the end of your custom.css
   - Or enqueue this file additionally
   ========================================================= */

.footer--dark {
    background: #000;
    color: #fff;
    border-top-color: #1f2937; /* gray-800 */
}

/* Make the grid/noise overlay a bit softer on dark */
.footer--dark .absolute.inset-0 {
    opacity: 0.12 !important;
}

/* Common Tailwind utility overrides inside footer */
.footer--dark .text-black {
    color: #fff;
}
.footer--dark .text-gray-600 {
    color: #d1d5db;
} /* gray-300 */
.footer--dark .text-gray-500 {
    color: #9ca3af;
} /* gray-400 */
.footer--dark .text-gray-400 {
    color: #9ca3af;
}
.footer--dark .border-black {
    border-color: #374151;
} /* gray-700 */
.footer--dark .border-gray-200 {
    border-color: #1f2937;
} /* gray-800 */
.footer--dark .border-gray-300 {
    border-color: #374151;
} /* gray-700 */
.footer--dark .bg-white {
    background: #0b0f1a;
} /* deep navy */
.footer--dark .bg-gray-50 {
    background: #0b0f1a;
}
.footer--dark .bg-gray-100 {
    background: #0f172a;
}
.footer--dark .shadow-sm,
.footer--dark .shadow-md {
    /* Dark-friendly shadow */
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.6),
        0 1px 2px rgba(0, 0, 0, 0.45);
}

/* Crosshair lines should be white in dark footer */
.footer--dark .crosshair::before,
.footer--dark .crosshair::after {
    background-color: #fff;
    opacity: 0.7;
}

/* Logo block in footer (you already have .footer-logo-block styles) */
.footer--dark .footer-logo-block {
    color: #fff;
    border-bottom-color: #fff;
}
.footer--dark .footer-logo-block:hover {
    opacity: 0.8;
}

/* Menu underline bar in footer nav */
.footer--dark .menu-link::before {
    background-color: #fff;
    opacity: 0.85;
}
.footer--dark .menu-link:hover {
    color: #e5e7eb; /* gray-200 */
}

/* Buttons / pills in footer */
.footer--dark .btn-view-more {
    border-color: #fff;
    background: #000;
    color: #fff;
}
.footer--dark .btn-view-more:hover {
    background: #fff;
    color: #000;
}

/* Links */
.footer--dark a:hover {
    opacity: 0.75;
}

/* Small separators, hr-like borders */
.footer--dark .h-px {
    background: #1f2937 !important;
}

/* Dark footer: prevent hover turning black */
.footer--dark a:hover {
    color: #e5e7eb !important; /* gray-200 */
}

/* 吹き出しテキスト部分のベーススタイル */
.liquid-speech-balloon-text {
    padding: 0em 1em !important;
}

/* =========================================================
   Responsive readability improvements (mobile / tablet)
   - PC design remains untouched
   ========================================================= */

/* Base safe spacing for all viewports */
.container-custom {
    width: min(100%, 1200px);
    margin-inline: auto;
    padding-inline: clamp(16px, 3vw, 32px);
    box-sizing: border-box;
}

.img-tech-border img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Tablet and below */
@media (max-width: 1024px) {
    main.pt-20 {
        padding-top: 64px !important;
    }

    /* keep original slider height/min-height so absolute slides don't collapse */

    .kv-wrapper .container-custom {
        gap: 2rem !important;
        padding-top: 2rem;
        padding-bottom: 5.25rem; /* avoid overlap with nav buttons */
    }

    .kv-content-wrap h2,
    .kv-title-clamp {
        line-height: 1.25;
        margin-bottom: 1rem !important;
    }

    .kv-content-wrap p {
        font-size: 0.95rem;
        line-height: 1.8;
        margin-bottom: 1rem !important;
    }

    .kv-wrapper .h-\[400px\] {
        height: min(42vw, 320px) !important;
    }

    .kv-wrapper .w-\[400px\],
    .kv-wrapper .h-\[400px\] {
        max-width: 100%;
    }

    /* Section wrappers */
    .space-y-24 > section,
    #case-study {
        scroll-margin-top: 88px;
    }

    /* Section heading block: title + button alignment */
    #research > div:first-child,
    #knowledge > div:first-child,
    #case-study > div:first-child,
    .space-y-24 > section > div:first-child {
        gap: 0.75rem;
    }

    /* Buttons become easier to tap */
    .btn-view-more {
        min-height: 40px;
        padding: 0.5rem 0.75rem;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .container-custom {
        padding-inline: 16px;
    }

    main.pt-20 {
        padding-top: 56px !important;
    }

    /* KV */
    .kv-wrapper {
        padding-bottom: 0.5rem;
    }

    .kv-wrapper {
        min-height: 700px !important;
    }

    .kv-wrapper .container-custom {
        padding-top: 3rem !important;
        padding-bottom: 5.5rem !important;
        gap: 1.25rem !important;
    }

    .kv-content-wrap .font-mono-tech.text-sm {
        font-size: 0.72rem !important;
        letter-spacing: 0.04em;
    }

    .kv-title-clamp,
    .kv-content-wrap h2 {
        font-size: 1.5rem !important; /* ~24px */
        line-height: 1.35 !important;
        letter-spacing: -0.01em;
        margin-bottom: 0.75rem !important;
    }

    .kv-content-wrap p {
        font-size: 0.9rem !important;
        line-height: 1.75 !important;
        margin-bottom: 0.9rem !important;
    }

    .kv-wrapper .h-\[400px\] {
        height: 220px !important;
    }

    .kv-wrapper .w-\[95\%\] {
        width: 92% !important;
    }

    .kv-wrapper .absolute.bottom-0 .container-custom {
        align-items: center;
        gap: 0.75rem;
    }

    .kv-nav-btn {
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Main content spacing */
    .container-custom.flex.flex-col.lg\:flex-row.gap-12.py-20.pb-24 {
        gap: 2rem !important;
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    .space-y-24 {
        display: flex;
        flex-direction: column;
        gap: 2.5rem;
    }

    .space-y-24 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 0 !important;
    }

    /* Section titles + View more stack */
    #research > div:first-child,
    #knowledge > div:first-child,
    #case-study > div:first-child,
    .space-y-24 > section > div:first-child {
        display: flex;
        align-items: flex-start !important;
        padding-bottom: 0.75rem !important;
        margin-bottom: 1rem !important;
    }

    #research > div:first-child .ml-auto,
    #knowledge > div:first-child .ml-auto,
    #case-study > div:first-child .ml-auto,
    .space-y-24 > section > div:first-child .ml-auto {
        margin-left: 0 !important;
    }

    .space-y-24 h2.text-3xl,
    #case-study h2.text-3xl,
    #research h2.text-3xl,
    #knowledge h2.text-3xl {
        font-size: 1.35rem !important;
        line-height: 1.2 !important;
    }

    /* Card meta / title readability */
    article .font-mono-tech.text-\[10px\] {
        font-size: 0.65rem !important;
        line-height: 1.3;
    }

    article h3.text-lg {
        font-size: 1rem !important;
        line-height: 1.55 !important;
    }

    article h3.text-sm {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    #knowledge p.text-xs,
    article p.text-xs {
        font-size: 0.78rem !important;
        line-height: 1.65 !important;
    }

    /* Box sections */
    #research.bg-gray-50,
    #case-study.bg-gray-50 {
        padding: 1rem !important;
    }

    /* Case study horizontal card on mobile */
    #case-study article.group,
    #case-study article.group > a {
        gap: 0.9rem !important;
    }

    /* Contact */
    #contact {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    #contact h2 {
        font-size: 1.5rem !important;
        line-height: 1.35 !important;
        margin-bottom: 0.75rem !important;
    }

    #contact p {
        font-size: 0.9rem !important;
        line-height: 1.8 !important;
        margin-bottom: 1rem !important;
    }

    #contact .flex.gap-4 {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem !important;
    }

    #contact .flex.gap-4 > a {
        width: 100%;
        text-align: center;
        padding-inline: 1rem !important;
        padding-top: 0.9rem !important;
        padding-bottom: 0.9rem !important;
    }
}

/* Narrow phones */
@media (max-width: 374px) {
    .container-custom {
        padding-inline: 12px;
    }

    .kv-title-clamp,
    .kv-content-wrap h2 {
        font-size: 1.35rem !important;
    }

    .space-y-24 h2.text-3xl,
    #case-study h2.text-3xl,
    #research h2.text-3xl,
    #knowledge h2.text-3xl {
        font-size: 1.2rem !important;
    }
}

@media (min-width: 1024px) and (max-height: 820px) {
    .sidebar-sticky {
        display: none !important;
    }
}
/* 固定ヘッダー(80px) + 少し余白 */
.article-content h2[id],
.article-content h3[id] {
    scroll-margin-top: 100px;
}

/* フローティングバナー (LLMO対策) */
.floating-banner-llmo {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: auto;
    text-decoration: none;
    transition: transform 0.3s cubic-bezier(0.2, 1, 0.3, 1);
}
.floating-banner-llmo:hover {
    transform: translateY(-4px);
}

.floating-banner-badge {
    background-color: #3d3d3d;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border: 1px solid #3d3d3d;
    margin-bottom: -1px;
    margin-right: 12px;
    z-index: 10;
    letter-spacing: 0.1em;
}

/* 変更箇所1：バナー本体の背景色をテック・イエローに変更 */
.floating-banner-body {
    background-color: #ffea5e; /* ここをシアン(#00E5FF)から変更 */
    border: 2px solid #3d3d3d;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 4px 4px 0 0 #3d3d3d;
    transition: box-shadow 0.3s cubic-bezier(0.2, 1, 0.3, 1);
}

/* 変更箇所2：ホバー時のシャドウ拡張（既存のまま） */
.floating-banner-llmo:hover .floating-banner-body {
    box-shadow: 6px 6px 0 0 #3d3d3d;
}

.floating-banner-icon {
    background-color: #ffffff;
    border: 2px solid #3d3d3d;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #292929;
    flex-shrink: 0;
}

.floating-banner-icon svg {
    width: 20px;
    height: 20px;
}

.floating-banner-text {
    display: flex;
    flex-direction: column;
    color: #3d3d3d;
}
.floating-banner-text .title-sub {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.2;
}
.floating-banner-text .title-main {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.1em;
}

@media (max-width: 767px) {
    .floating-banner-llmo {
        display: none !important;
    }
}
