@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;700&display=swap');

/* --- Global Styles --- */
:root {
    --primary-color: #e6762b; /* Tomato - vibrant and playful */
    --secondary-color: #5fae1d; /* SteelBlue - trustworthy */
    --accent-color: #F5C959; /* Gold - exciting */
    --text-color: #333;
    --background-color: #f9f9f9; /* Light gray for a clean look */
    --container-width: 960px;
    --font-main: 'Nunito', sans-serif;
    --font-headings: 'Fredoka One', cursive;
    --voxel-green: #8ad12e; /* A playful green */
    --voxel-blue: #3b82f6; /* A bright blue */
    --voxel-orange: #f59f39; /* A vibrant orange */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 80px; /* Placeholder for fixed header height, adjust as needed */
}

.container {
    width: 90%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-headings);
    color: var(--background-color);
    margin-bottom: 0.8em;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

a:hover {
    text-decoration: underline;
}

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

/* --- Header --- */
header {
    background-color: var(--background-color); /* Match body or use a specific header color */
    padding: 0.5em 0; /* Adjust padding for fixed header */
    border-bottom: 1px solid #ddd;
    text-align: center; /* Center logo and nav on small screens */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .logo {
    font-size: 2.2em; /* Increased size */
    color: var(--primary-color);
    margin-bottom: 0; /* Remove margin if nav is inline */
    display: inline-block; /* Allows vertical alignment with nav */
    text-shadow: 2px 2px 0px var(--secondary-color); /* Simple 3D effect */
    transition: transform 0.3s ease, text-shadow 0.3s ease;
}

header .logo img {
    max-height: 60px; /* Increased by 20% from 50px */
    width: auto;
    vertical-align: middle; /* Helps align with nav text if inline */
}

header .logo:hover {
    transform: scale(1.05) rotate(-2deg);
    text-shadow: 3px 3px 0px var(--accent-color), -3px -3px 0px var(--voxel-blue);
}

header nav ul {
    list-style: none;
    display: flex;
    padding: 0;
    margin: 0; /* Ensure no extra margin */
}

header nav ul li {
    margin-left: 20px;
}

header nav ul li a {
    font-weight: bold;
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

header nav ul li a:hover,
header nav ul li a.active { /* For current page indication */
    color: var(--primary-color);
    text-decoration: none;
}

/* --- Responsive Header --- */
@media (max-width: 768px) {
    body {
        padding-top: 120px; /* Adjust for even more compact mobile header */
    }

    header {
        padding: 5px 0; /* Reduce vertical padding */
    }

    header .container {
        flex-direction: column;
    }

    header .logo {
        margin-bottom: 0; /* Remove space between logo and nav */
    }

    header .logo img {
        max-height: 50px; /* Slightly reduce logo size on mobile */
    }

    header nav ul {
        justify-content: center;
        flex-wrap: wrap;
    }

    header nav ul li {
        margin: 2px 10px; /* Adjust margin for wrapped items */
    }
}

/* Hero Slideshow Styles */
.slideshow-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Behind hero-content */
}

#hero .slideshow-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the area, might crop */
    object-position: center; /* Center the image */
    opacity: 0;
    transition: opacity 1.5s ease-in-out; /* Fade transition */
}

#hero .slideshow-container img.slide-active {
    opacity: 1;
}

.slideshow-container img.slide-active {
    opacity: 1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Adjust darkness here */
    z-index: 2; /* Between slideshow and content */
}

#hero .container.hero-content {
    position: relative !important; /* Ensure it's above the slideshow - DIAGNOSTIC */
    z-index: 10; /* Ensure it's well above other layers */
    /* Add text shadow for better readability on various backgrounds */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#hero .hero-content h2 {
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

#hero .hero-content p {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Keyframe animations for directional Ken Burns effect */
@keyframes kenburns-down {
  0% { object-position: center 40%; }
  100% { object-position: center 60%; }
}

@keyframes kenburns-up {
  0% { object-position: center 60%; }
  100% { object-position: center 40%; }
}

.animate-kenburns-down {
  animation-name: kenburns-down;
  animation-duration: 5s; /* Matches JS slideInterval */
  animation-timing-function: linear; /* Consistent speed */
  animation-fill-mode: forwards;    /* Keep end state */
  animation-iteration-count: 1;     /* Play once per slide */
}

.animate-kenburns-up {
  animation-name: kenburns-up;
  animation-duration: 5s; /* Matches JS slideInterval */
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  animation-iteration-count: 1;
}

/* --- Main Content --- */
main {
    flex-grow: 1; /* Ensures footer stays at the bottom */
    padding: 2em 0;
    padding-top: 120px; /* Add padding to prevent overlap with fixed header */
}

/* --- Hero Section --- */
#hero {
    color: #fff;
    padding: 8em 0 9em; /* Increased padding for a taller hero section */
    text-align: center;
    position: relative; /* Crucial for positioning slideshow and content */
    overflow: hidden; /* Ensures slideshow images don't break layout */
    isolation: isolate; /* Force a new stacking context */
    border-bottom: 5px solid var(--accent-color);
}

#hero .container {
    position: relative;
    z-index: 1;
}

#hero h1 {
    font-size: 3.8em; /* Larger */
    color: #fff;
    margin-bottom: 0.4em;
    text-shadow: 0 0 10px rgba(0,0,0,0.3), 0 0 20px rgba(0,0,0,0.2), 3px 3px 0px rgba(0,0,0,0.3);
    line-height: 1.5;
}

#hero h2 {
    font-size: 3.8em; /* Larger */
    color: #fff;
    margin-bottom: 0.4em;
    text-shadow: 0 0 10px rgba(0,0,0,0.3), 0 0 20px rgba(0,0,0,0.2), 3px 3px 0px rgba(0,0,0,0.3);
    line-height: 1.5;
}

#hero p {
    font-size: 1.5em; /* Larger */
    margin-bottom: 2.2em; /* More space */
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
    font-weight: 400; /* Nunito regular */
}

.cta-button {
    display: inline-block;
    background-color: var(--accent-color);
    color: #333; /* Darker text for better contrast on gold */
    padding: 0.9em 2.2em;
    border-radius: 50px;
    font-weight: bold; /* Nunito bold */
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    font-size: 1.25em;
    font-family: var(--font-headings); /* Fredoka One for CTA */
    box-shadow: 0 5px 15px rgba(0,0,0,0.15), 0 2px 5px rgba(0,0,0,0.1);
    animation: pulseCta 1.8s infinite cubic-bezier(0.65, 0, 0.35, 1);
    letter-spacing: 0.5px;
}

.cta-button:focus {
    background-color: var(--accent-color); /* Revert to normal background */
    color: #333; /* Revert to normal text color */
    text-decoration: none;
    /* Explicitly reset transform and box-shadow to normal state */
    transform: translateY(0) scale(1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15), 0 2px 5px rgba(0,0,0,0.1);
    /* animation-play-state is inherited or remains as default (playing) */
    outline: none; /* Remove outline for general focus, e.g., mouse click */
}

.cta-button:focus-visible {
    /* Add a visible focus outline ONLY for keyboard navigation or when browser deems it necessary */
    outline: 3px solid var(--secondary-color); 
    outline-offset: 2px;
}

.cta-button:hover {
    background-color: #fff; 
    color: var(--primary-color);
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2), 0 4px 8px rgba(0,0,0,0.15);
    text-decoration: none;
    animation-play-state: paused;
}

.portfolio-carousel-track:hover {
    animation-play-state: paused;
}

.portfolio-item-title {
    text-align: center;
    margin-top: 8px;
    font-size: 0.9em;
    color: var(--text-color);
}

.portfolio-item-title a {
    color: var(--primary-color);
    text-decoration: none;
}

.portfolio-item-title a:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

.video-title-trigger {
    cursor: pointer;
    color: var(--primary-color);
}

.video-title-trigger:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

.portfolio-item-title a {
    color: var(--primary-color);
    text-decoration: none;
}

.portfolio-item-title a:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

.video-title-trigger {
    cursor: pointer;
    color: var(--primary-color);
}

.video-title-trigger:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

@keyframes pulseCta {
    0% { transform: scale(1); box-shadow: 0 5px 15px rgba(0,0,0,0.15), 0 2px 5px rgba(0,0,0,0.1); }
    50% { transform: scale(1.03); box-shadow: 0 7px 18px rgba(0,0,0,0.2), 0 3px 7px rgba(0,0,0,0.15); }
    100% { transform: scale(1); box-shadow: 0 5px 15px rgba(0,0,0,0.15), 0 2px 5px rgba(0,0,0,0.1); }
}

/* --- Home Sections General & Specific Layouts --- */
.home-section {
    padding: 60px 0; /* Default vertical padding for all sections */
    text-align: center;
}

.home-section:not(.content-feature-section) .container {
    max-width: 1100px; /* Standard container width */
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px; /* Add side padding for these containers */
    padding-right: 20px;
}

.content-feature-section {
    overflow: hidden;
}

.content-feature-section .container {
    background-color: #ffffff;
    padding: 35px 45px; /* Internal padding for content */
    border-radius: 12px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.09);
    text-align: left;
    width: auto; /* Allow it to fill according to margins */
    max-width: none; /* Ensure it can extend fully */
    margin-bottom: 40px;
    position: relative;
}

/* Ensure service section's inner container respects standard max-width */
#services.content-feature-section .container {
    max-width: var(--container-width);
    width: 90%; /* Re-apply standard width behavior if overridden by 'auto' */
    /* If the padding from .content-feature-section .container (35px 45px) is too large, */
    /* you might want to revert to standard container padding or a custom one here. */
    /* For example, to use standard padding: */
    /* padding: 0 20px; */ 
}

#intro-services.content-feature-section .container {
    margin-left: 5%;
    margin-right: 0;
    background-color: #ffffff;
}

/* Styles for the inner content wrapper in the services section */
#intro-services .content-inner {
    width: 90%;
    max-width: var(--container-width); /* Should be 960px by default */
    margin-left: auto;
    margin-right: auto;
    /* padding: 0 20px; */ /* Optional: if you want standard container padding inside */
}

#intro-services .service-content-panel p {
    text-align: left; /* Align service description paragraphs to the left */
    margin-left: 0; /* Reset margin if previously centered */
    margin-right: 0; /* Reset margin if previously centered */
    max-width: 100%; /* Allow full width within its container */
}

#intro-services .service-tabs-container {
    display: flex;
    align-items: flex-start; /* Align items to the top */
    /* gap: 20px; */ /* Removed to eliminate space between nav and content */
}

#intro-services .service-tabs-nav {
    flex: 0 0 200px; /* Fixed width for the tab navigation. Adjust as needed. */
}

#intro-services .service-tabs-content {
    flex: 1; /* Take up the remaining space */
    min-width: 0; /* Prevents content from overflowing and breaking flexbox layout */
}

#intro-services .service-tabs-nav .service-tab-button {
    display: block;
    width: 100%;
    margin-bottom: 10px; /* Space between buttons */
    padding: 10px 15px;
    text-align: center;
    background-color: #f0f0f0; /* Example background */
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#intro-services .service-tabs-nav .service-tab-button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#intro-services .service-tabs-nav .service-tab-button:hover:not(.active) {
    background-color: #e0e0e0;
}

#intro-services .service-tabs-content {
    flex: 1; /* This should already be here from previous step, ensuring it is */
    min-width: 0; /* This should also be here */
    position: relative;
    overflow-x: hidden; /* Prevent content from expanding the container horizontally */
    /* min-height is removed from here and applied to individual panels */
}

#intro-services .service-content-panel {
    width: 100%;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    /* min-height: 380px; was here, can be re-added if needed for consistent panel height */
}

#intro-services .service-content-panel {
    min-height: 380px; /* IMPORTANT: Adjust this value based on the 'アバター・アセット' tab's actual height including padding. */
    /* width: 900px; */      /* Removed fixed width, will take width from parent .service-tabs-content */
    /* margin-left: auto; */ /* No longer needed for centering as parent handles layout */
    /* margin-right: auto; */
    width: 100%; /* Take full width of its parent .service-tabs-content */
    box-sizing: border-box; /* Ensures padding and border are included in the element's total width and height. */
    /* If panels need consistent internal spacing and don't have it yet, you might add it here, e.g., padding: 20px 30px; */
    /* display: none; for inactive panels and display: block; for active panel are typically handled by JavaScript. */
}

#intro-portfolio.content-feature-section .container {
    margin-left: 0;
    margin-right: 0;
    background-color: #e0e0e0;
}

#intro-process.content-feature-section .container {
    margin-left: 5%;
    margin-right: 0;
    background-color: #ffffff;
}

main > .content-feature-section:last-child .container {
    margin-bottom: 0;
}

.home-section:last-of-type {
    border-bottom: none;
}

#contact {
    background-color: var(--secondary-color);
    color: #ffffff;
    padding-top: 80px;
    padding-bottom: 80px;
}

#contact h3 {
    color: #ffffff;
    font-size: 2.5em;
    margin-bottom: 0.8em;
}

#contact p {
    color: #f0f0f0;
    font-size: 1.1em;
    line-height: 1.7;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Process Flow Section
   ========================================================================== */

.process-flow-container {
    max-width: 700px; /* Max width for the flow content */
    margin-left: auto;
    margin-right: auto;
    margin-top: 40px;
    margin-bottom: 30px;
    position: relative;
    /* Add a line connecting the steps */
}

.process-flow-container::before {
    content: '';
    position: absolute;
    left: 80px; /* Shift line further right */
    top: 10px;
    bottom: 50px; /* Shorten line from the bottom */
    width: 2px;
    background-color: var(--accent-color);
    z-index: 1;
}

.process-step {
    position: relative;
    margin-bottom: 30px;
    padding-left: 0; /* Reset padding, step number will be absolute */
    z-index: 2;
}

.process-step:last-child {
    margin-bottom: 0;
}

.step-number-title {
    margin-bottom: 8px;
    /* No special positioning needed now */
}

.step-number {
    background-color: var(--accent-color);
    color: #fff;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9em;
    min-width: 60px;
    text-align: center;
    position: absolute;
    left: 80px; /* Shift step number further right */
    top: 0;
    z-index: 3; /* Ensure it's above the line if overlapping */
}

.process-step h4 {
    font-size: 1.3em;
    color: var(--primary-color);
    margin-bottom: 0.5em;
    text-align: center; /* Center the title text */
}

.process-step p {
    font-size: 1em;
    line-height: 1.6;
    color: #333;
    text-align: center; /* Center the description text */
    max-width: 80%; /* Prevent very wide lines of text */
    margin-left: auto;
    margin-right: auto;
}

.process-notes {
    background-color: #f9f9f9; /* Light background for emphasis */
    border-left: 4px solid var(--accent-color);
    padding: 20px;
    margin-top: 40px;
    font-size: 0.95em;
    line-height: 1.7;
    border-radius: 4px;
    max-width: 700px; /* Match the flow container width */
    margin-left: auto;
    margin-right: auto;
}

/* Responsive adjustments for smaller screens if needed */
@media (max-width: 768px) {
    .process-flow-container {
        max-width: 100%; /* Use full width to remove side margins */
    }
    .process-flow-container::before {
        left: 20px; /* Move line to the left */
        top: 5px;
        bottom: 60px; /* Shorten line further from the bottom */
    }
    .process-step {
        padding-left: 85px; /* Add padding to avoid overlap with line/step number */
        /* width and max-width are not needed if it's a simple block */
    }
    .step-number {
        left: 20px; /* Move step number to the left */
        font-size: 0.8em;
        padding: 4px 8px;
        min-width: 50px;
    }
    .process-step h4 {
        font-size: 1.1em;
    }
    .process-notes {
        max-width: 90%;
    }
}

#contact .contact-email {
    margin-top: 1.5em;
    font-size: 1.2em;
}

#contact .contact-email a {
    color: var(--accent-color);
    font-weight: bold;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: border-bottom-color 0.3s ease;
}

#contact .contact-email a:hover,
#contact .contact-email a:focus {
    color: #ffffff;
    border-bottom-color: var(--accent-color);
}

.home-section h3 {
    font-size: 2em;
    text-align: center;
    margin-bottom: 1em;
    color: var(--primary-color);
}

.home-section p {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 1.5em auto;
}

/* --- Scroll Fade-in Animation --- */
.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Services Section --- */
.section-lead {
    font-size: 1.1em;
    margin-bottom: 1.5em;
    color: #555;
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.service-tabs-container {
    display: flex;
    margin-top: 2em;
    border-radius: 8px; 
    overflow: hidden; 
    border: 1px solid #e0e0e0;
    width: 100%;
}

.service-tabs-nav {
    display: flex;
    flex-direction: column;
    width: 200px; 
    background-color: rgba(245, 245, 245, 0.9);
    padding: 10px 0;
    border-right: 1px solid #d0d0d0;
}

.service-tab-button {
    background-color: transparent;
    border: none;
    padding: 15px 20px;
    text-align: left;
    cursor: pointer;
    font-size: 1em;
    color: #333;
    transition: background-color 0.3s, color 0.3s;
    border-bottom: 1px solid #ddd;
}

.service-tab-button:last-child {
    border-bottom: none;
}

.service-tab-button:hover {
    background-color: #f0f0f0;
    color: var(--primary-color);
}

.service-tab-button.active {
    background-color: var(--primary-color);
    color: #fff;
    font-weight: bold;
    border-left: 3px solid var(--accent-color);
    padding-left: 17px;
}

.service-tabs-content {
    flex-grow: 1;
    position: relative;
}

.service-content-panel {
    display: none;
    padding: 30px;
    color: #fff;
    min-height: 300px;
    background-size: cover;
    background-position: center;
    position: relative;
    z-index: 1;
}

.service-content-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: -1;
    border-radius: 0 8px 8px 0;
}

.service-content-panel.active {
    display: block;
}

.service-bg-avatar { background-image: url('../img/placeholder_avatar.webp'); }
.service-bg-world { background-image: url('../img/placeholder_world.webp'); }
.service-bg-pv { background-image: url('../img/placeholder_pv.webp'); }

.service-content-panel h4 {
    color: #fff;
    font-size: 1.8em;
    margin-bottom: 0.75em;
}

.service-content-panel p { line-height: 1.7; margin-bottom: 1em; }
.service-content-panel h5 { font-size: 1.1em; color: #f0f0f0; font-weight: bold; margin-top: 1.5em; margin-bottom: 0.5em; }
.service-content-panel ul { list-style: disc; margin-left: 20px; padding-left: 0; }
.service-content-panel ul li { margin-bottom: 0.5em; line-height: 1.6; }

/* --- Portfolio Carousel --- */
.portfolio-carousel-container {
    width: 100%;
    overflow: hidden;
    margin-top: 2em;
    position: relative;
    padding-top: 15px;
    padding-bottom: 15px;
}

.portfolio-carousel-track {
    display: flex;
    will-change: transform;
    --scroll-distance: 0px;
    --animation-duration: 30s;
    animation: scrollPortfolio var(--animation-duration) linear infinite;
}

.portfolio-item {
    flex-shrink: 0;
    width: 546px;
    margin-right: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    overflow: hidden;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    cursor: pointer;
}

.portfolio-item:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.portfolio-item img {
    width: 100%;
    height: 351px;
    object-fit: cover;
}

@keyframes scrollPortfolio {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-1 * var(--scroll-distance))); }
}

/* --- Responsive Styles for Service Section --- */

/* Hide mobile nav buttons by default */
.mobile-nav-button {
    display: none;
}

@media (max-width: 768px) {
    #intro-services .service-tabs-container {
        flex-direction: column; /* Stack nav and content vertically */
    }

    #intro-services .service-tabs-nav {
        display: flex; /* Use flex for positioning nav buttons and active tab */
        flex-direction: column; /* Stack items vertically */
        align-items: stretch; /* Make items take full width */
        width: 100%;
        border-right: none; /* Remove the side border */
        border-bottom: 1px solid #ddd; /* Add a border below the tabs */
        padding: 0;
        position: relative; /* For absolute positioning of nav buttons if needed, though flex might be enough */
    }

    /* Show mobile nav buttons and style them */
    .mobile-nav-button {
        display: block;
        background-color: #f0f0f0;
        border: 1px solid #ccc;
        padding: 10px 15px;
        cursor: pointer;
        font-size: 1.2em;
        line-height: 1;
        z-index: 10;
        flex-shrink: 0; /* Prevent nav buttons from shrinking */
        width: 100%;
        box-sizing: border-box;
        border-radius: 4px; /* Uniform radius */
        text-align: center;
    }

    .prev-tab-button {
        /* Specific radii removed, general radius applied to .mobile-nav-button */
        margin-bottom: 8px;
    }



    #intro-services .service-tabs-nav .service-tab-button {
        flex-grow: 1; /* Active tab takes up available space between nav buttons */
        /* width: 100%; Removed, rely on flex-grow */
        padding: 10px 5px;
        text-align: center;
        white-space: nowrap;
        margin-bottom: 0;
        border-radius: 0;
        border-bottom: none;
        border-right: none; /* Remove separators, nav buttons will have their own borders */
        display: none; /* Hide all tabs by default on mobile */
    }

    #intro-services .service-tabs-nav .service-tab-button.active {
        display: block; /* Show only the active tab */
        min-width: 0; /* Allow active tab to shrink */
        overflow: hidden; /* Hide overflowing text */
        text-overflow: ellipsis; /* Show ellipsis for overflow */
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 8px; /* Space before the 'next' button */
        border-radius: 4px; /* Uniform radius */
        border-bottom-color: transparent; /* Remove underline effect for stacked view */
        /* background-color and color are inherited from non-media query .active style */
    }

    /* Remove separator from the last button - no longer needed as only active is shown */
    /* #intro-services .service-tabs-nav .service-tab-button:last-child {
        border-right: none; 
    } */

    #intro-services .service-content-panel {
        padding: 20px 15px; /* Adjust padding for smaller screens */
    }
}

/* --- Footer --- */
.footer-logo {
    /* text-align: center; */ /* Centering handled by img's auto margins */
    margin-bottom: 15px; /* Adjust as needed */
}

.footer-logo img {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-height: 50px; /* Adjust as needed, can be different from header logo */
    width: auto;
}

footer {
    background-color: #333;
    color: #f4f4f4;
    text-align: center;
    padding: 2em 0;
    margin-top: auto;
}

footer p { margin-bottom: 0.5em; }
footer a { color: var(--accent-color); }
footer a:hover { color: #fff; }

.social-icons {
    text-align: center;
    margin-top: 15px; /* Space above icons */
}

.social-icons a {
    color: #f4f4f4; /* Match footer text color */
    font-size: 1.8em; /* Adjust icon size */
    margin: 0 10px; /* Space between icons */
    transition: color 0.3s ease;
    text-decoration: none; /* Prevent underline */
}

.social-icons a:hover {
    color: var(--accent-color); /* Highlight color on hover */
    text-decoration: none; /* Ensure no underline on hover */
}

/* --- Portfolio Modal Styles --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.85); /* Darker overlay */
    padding-top: 40px;
    padding-bottom: 40px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: #1e1e1e; /* Dark theme for modal */
    color: #f1f1f1;
    margin: auto;
    padding: 20px;
    border: 1px solid #444;
    width: 90%;
    max-width: 900px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.modal-close-button {
    color: #a8a8a8;
    position: absolute;
    top: 25px;  /* Adjusted for larger size */
    right: 25px; /* Adjusted for larger size */
    font-size: 52.5px; /* 35px * 1.5 */
    font-weight: bold;
    transition: color 0.3s ease;
    z-index: 110; /* Ensure it's on top */
    line-height: 1; /* To better center the '×' character */
    padding: 0; /* Reset padding */
    /* Consider explicit width/height if needed for better click area or alignment */
    /* width: 55px; */
    /* height: 55px; */
    /* display: flex; */ /* For centering if width/height are set */
    /* align-items: center; */
    /* justify-content: center; */
}

.modal-close-button:hover,
.modal-close-button:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.modal-body {
    margin-top: 15px;
}

/* --- Slideshow Specific Styles (REVISED) --- */
.modal-body .slideshow-container {
    position: relative;
    margin: auto;
}

/* MODIFIED: Enforce 16:9 aspect ratio */
.slideshow-main-image {
    position: relative;
    overflow: hidden;
    background-color: #000;
    border-radius: 8px;
    margin-bottom: 15px;
    width: 100%;
    aspect-ratio: 16 / 9; /* Enforce 16:9 aspect ratio */
}

/* MODIFIED: Make image fill the container */
.slideshow-main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Fit inside without distortion, maintaining aspect ratio */
    opacity: 1; /* Ensure main image is visible */
}

/* Ensure iframe is responsive */
.slideshow-main-image iframe {
    width: 100%;
    height: 100%;
}

/* Slideshow Fullscreen Button */
.slideshow-fullscreen-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    line-height: 40px; /* Center icon vertically */
    text-align: center;
    cursor: pointer;
    z-index: 15; /* Ensure it's above the image but below modal controls if any overlap */
    transition: background-color 0.3s ease;
}

.slideshow-fullscreen-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Adjustments for when slideshow is in fullscreen */
.slideshow-main-image:fullscreen {
    background-color: #000; /* Ensure black background in fullscreen */
    padding: 0; /* Remove any padding */
}

.slideshow-main-image:fullscreen img {
    object-fit: contain; /* Ensure image fits screen without cropping */
    max-height: 100vh;
    max-width: 100vw;
}

/* Hide other slideshow controls when main image is fullscreen */
.slideshow-main-image:fullscreen ~ .slideshow-prev,
.slideshow-main-image:fullscreen ~ .slideshow-next,
.slideshow-main-image:fullscreen ~ .slideshow-thumbnails,
.slideshow-main-image:fullscreen .slideshow-prev, /* If prev/next are inside main-image */
.slideshow-main-image:fullscreen .slideshow-next { /* If prev/next are inside main-image */
    display: none;
}

/* Slideshow Thumbnails */
.slideshow-thumbnails {
    display: flex;
    justify-content: center; /* Center thumbnails horizontally */
    align-items: center;
    gap: 10px; /* Space between thumbnails */
    margin-top: 10px;
    flex-wrap: wrap; /* Allow thumbnails to wrap to next line if not enough space */
}

.slideshow-thumbnail {
    width: 80px;  /* Explicit width for the container */
    height: 45px; /* Explicit height for the container */
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.3s ease, transform 0.3s ease;
    overflow: hidden; /* Ensure image respects border-radius */
    box-sizing: border-box; /* Include border in width/height calculation */
}

.slideshow-thumbnail img {
    width: 100%; /* Fill the container */
    height: 100%;/* Fill the container */
    object-fit: cover;
    display: block;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.slideshow-thumbnail:hover img {
    opacity: 1;
    transform: scale(1.05); /* Slight zoom on hover */
}

.slideshow-thumbnail img.active-thumbnail-img-state { /* Updated class name from JS */
    opacity: 1;
}

/* Ensure the border is on the container, not the image itself for active state */
.slideshow-thumbnail.active-thumbnail-container {
    border: 2px solid #007bff; /* Highlight for the active thumbnail's container */
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.5); /* Optional: add shadow to container */
}

/* Video Player Styles */
.video-player-container {
    width: 100%;
    max-width: 90vw; /* Max width relative to viewport width */
    max-height: 80vh; /* Max height relative to viewport height */
    margin: auto;
    display: flex; /* For centering the video element if it's smaller */
    justify-content: center;
    align-items: center;
    background-color: #000; /* Background for letterboxing if video aspect ratio differs */
}

.video-player-container video {
    display: block;
    max-width: 100%;   /* Ensure video doesn't overflow container width */
    max-height: 100%;  /* Ensure video doesn't overflow container height */
    height: auto;      /* Maintain aspect ratio if width is constrained */
    width: auto;       /* Maintain aspect ratio if height is constrained */
}

.slideshow-prev, .slideshow-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%); /* Vertical centering */
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    transition: background-color 0.3s ease;
    background-color: rgba(0, 0, 0, 0.4);
    user-select: none;
    z-index: 100; /* High z-index to be on top */
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slideshow-prev {
    left: 15px;
}

.slideshow-next {
    right: 15px;
}

.slideshow-prev:hover, .slideshow-next:hover {
    background-color: rgba(0, 0, 0, 0.7);
}



/* X Post Embed Specific Styles */
.x-post-embed {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    background-color: #fff; /* White background for tweet */
    border-radius: 8px;
    padding: 10px;
}

.x-post-embed blockquote.twitter-tweet {
    margin: 0 auto !important;
}


/* --- Responsive Design --- */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        align-items: center;
    }

    header .logo {
        margin-bottom: 0em;
    }

    header nav ul {
        padding-left: 0;
        margin-top: 1em;
        flex-wrap: wrap;
        justify-content: center;
    }

    header nav ul li {
        margin: 0 10px 10px 10px;
    }

    #hero h2 {
        font-size: 2.5em;
    }

    #hero p {
        font-size: 1.1em;
    }

    .home-section h3 {
        font-size: 1.8em;
    }

    .service-tabs-container {
        flex-direction: column;
    }

    .service-tabs-nav {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #d0d0d0;
    }
    .service-tab-button {
        border-bottom: none;
        border-right: 1px solid #ddd;
        flex-shrink: 0;
    }
    .service-tab-button.active {
        border-left: none;
        border-bottom: 3px solid var(--accent-color);
        padding-left: 20px;
    }

    .portfolio-item {
        width: 300px;
        height: auto;
    }
    .portfolio-item img {
        height: 195px;
    }

    .slideshow-thumbnail img {
        width: 80px;
        height: 48px;
    }
}

/* --- Supported Platforms Section --- */
.supported-platforms {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee; /* 上の文章との区切り線 */
}

.supported-platforms h4 {
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1.1em;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.platform-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px; /* ロゴ間のスペース */
    flex-wrap: wrap; /* 画面が狭い場合に折り返す */
}

.platform-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.platform-logo img {
    height: 90px; /* ロゴの高さを指定 (2倍に) */
    width: auto;
    /* filter: grayscale(100%) opacity(60%); */ /* ホバーエフェクト削除のためコメントアウト */
    /* transition: filter 0.3s ease, transform 0.3s ease; */ /* ホバーエフェクト削除のためコメントアウト */
}

.platform-logo span {
    font-size: 0.9em;
    font-weight: 700;
    color: #888;
    /* transition: color 0.3s ease; */ /* ホバーエフェクト削除のためコメントアウト */
}

/* ロゴにマウスを乗せた時の効果は削除 */
/* .platform-logo:hover img {
    filter: grayscale(0%) opacity(100%);
    transform: scale(1.1);
}

.platform-logo:hover span {
    color: var(--primary-color);
} */
