:root {
    /* Standard Theme (Default) */
    --color-primary: #2c3e50;
    --color-accent: #e67e22;
    --color-bg: #ffffff;
    --color-text: #333333;
    --color-light-gray: #f5f5f5;
    --color-footer-bg: #1a252f;
    --color-footer-text: #bdc3c7;

    --font-main: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;

    --header-height: 80px;
    --container-width: 1200px;
}

[data-theme="dark"] {
    --color-primary: #34495e;
    --color-accent: #e74c3c;
    --color-bg: #2c3e50;
    --color-text: #ecf0f1;
    --color-light-gray: #34495e;
    --color-footer-bg: #000000;
}

[data-theme="warm"] {
    --color-primary: #8e44ad;
    --color-accent: #f1c40f;
    --color-bg: #fffbf0;
    --color-text: #4a4a4a;
}

/* Reset & Base */
body {
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    margin: 0;
    padding: 0;
    /* IMP-001: Sticky Footer Layout */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    /* IMP-001: Main content takes remaining space */
    flex: 1;
}

/* Typography */
h1,
h2,
h3 {
    margin-bottom: 1rem;
    line-height: 1.3;
}

a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s;
}

a:hover {
    opacity: 0.7;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: var(--color-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header .container,
/* Helper for direct child if container wrapper is used or not, adjusted for helpers.php structure */
header.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.site-logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-logo img {
    height: 40px;
    /* Default height */
    width: auto;
    object-fit: contain;
}

/* Hide text on mobile if logo exists, or keep it small? User wanted both "next to" */
@media (max-width: 600px) {
    .site-logo .logo-text {
        font-size: 1.2rem;
    }

    .site-logo img {
        height: 30px;
    }
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 20px;
}

.nav-list a {
    text-decoration: none;
    color: var(--color-text);
    font-weight: 500;
    transition: color 0.3s;
}

/* Hamburger Menu Button */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 2000;
}

.menu-toggle .bar {
    width: 30px;
    height: 3px;
    background-color: var(--color-primary);
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

/* Mobile Nav Styles */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .site-nav {
        position: fixed;
        top: 0;
        right: -100%; /* Slide out */
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--color-bg);
        box-shadow: -2px 0 5px rgba(0,0,0,0.2);
        z-index: 1500;
        padding-top: 80px; /* Space for close button/header */
        transition: right 0.3s ease-in-out;
        overflow-y: auto;
    }

    .site-nav.active {
        right: 0;
    }

    .nav-list {
        flex-direction: column;
        gap: 0;
    }

    .nav-list a {
        display: block;
        padding: 15px 20px;
        border-bottom: 1px solid #eee;
        font-size: 1.1rem;
    }

    /* Submenu Mobile */
    .nav-list .submenu {
        position: static; /* Collapse into flow */
        display: none; /* Hidden by default */
        box-shadow: none;
        border: none;
        padding: 0;
        background: #f9f9f9;
    }

    /* Accordion Toggle */
    .has-children.open .submenu {
        display: block;
        animation: fadeIn 0.3s;
    }
    
    .has-children > a::after {
        content: '+';
        float: right;
        font-weight: bold;
    }

    .has-children.open > a::after {
        content: '-';
    }

    /* Hamburger Animation */
    .menu-toggle.active .bar:nth-child(1) {
        transform: rotate(45deg);
    }
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: rotate(-45deg);
    }
}

/* Prevent Scroll on Body */
.no-scroll {
    overflow: hidden;
}

.nav-list a:hover,
.nav-list a.active {
    /* IMP-003: Active state */
    color: var(--color-accent);
}

/* Emergency Bar */
.emergency-bar {
    background-color: #c0392b;
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: bold;
}

/* Holiday Bar (IMP-400) */
.holiday-bar {
    background-color: #3498db;
    /* Blue for holiday */
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: bold;
}

/* Footer */
.site-footer {
    background-color: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: 50px 0;
    margin-top: 60px;
}

/* Utility Classes */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--color-primary);
    color: white;
    border-radius: 4px;
}

.btn-accent {
    background-color: var(--color-accent);
}


.section-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
    color: var(--color-primary);
}

/* Page Header with Background */
.page-header {
    background: var(--color-light-gray);
    padding: 60px 0;
    /* Increased padding */
    margin-bottom: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header.has-bg {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.page-header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    /* Dark overlay */
    z-index: 1;
}

.page-header h1 {
    position: relative;
    z-index: 2;
    margin: 0;
}

/* Works Grid Layout */
.works-grid {
    display: grid;
    /* Use auto-fill to prevent items from stretching to full width if there are few of them. */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.work-card {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #fff;
    /* Ensure card takes full height of grid cell */
    height: 100%;
    display: flex;
    flex-direction: column;
}

.work-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.work-img {
    height: 200px;
    background-size: cover;
    background-position: center;
    width: 100%;
}

.work-img-placeholder {
    height: 200px;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    width: 100%;
}

.work-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.work-body h3 {
    margin: 10px 0;
}

/* Works Filter & Sort Nav */
.filter-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-nav .btn {
    background: #ddd;
    color: #333;
    border: none;
    cursor: pointer;
}

.filter-nav .btn.btn-accent {
    background: var(--color-accent);
    color: white;
}

.sort-nav select {
    padding: 8px 15px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    font-size: 0.95rem;
    cursor: pointer;
}

/* Real Estate Grid (Same as Works) */
.re-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.re-card {
    display: flex;
    flex-direction: column;
    /* Changed from row to column for grid */
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    height: 100%;
    /* Full height */
    transition: transform 0.2s, box-shadow 0.2s;
}

.re-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.re-img {
    width: 100%;
    /* Full width */
    height: 200px;
    background: #eee;
    position: relative;
}


/* Real Estate Specific Styles */
.status-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    color: white;
    border-radius: 4px;
    font-weight: bold;
}

.status-badge.available {
    background: var(--color-accent);
}

.status-badge.sold {
    background: #95a5a6;
}

.re-type-area {
    margin-bottom: 10px;
    color: #666;
    font-size: 0.9rem;
}

.price {
    font-size: 1.5rem;
    color: #e74c3c;
    font-weight: bold;
    margin-bottom: 10px;
}

.re-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
    padding-top: 15px;
}

/* Pushed to bottom */
.btn-fav {
    background: white;
    border: 1px solid #ccc;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    color: #e74c3c;
}

.btn-fav.active {
    background: #e74c3c;
    color: white;
}


/* Index Page Hero Section */
.hero-section {
    position: relative;
    color: white;
    padding: 100px 0;
    text-align: center;
    overflow: hidden;
    background: #333;
    /* Fallback */
}

/* Video Background */
.hero-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

/* Dynamic Background Classes (Controlled by inline style originally, simplified here for overrides) */
.hero-bg-static {
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('/assets/img/default_hero.png');
    background-size: cover;
    background-position: center;
}

@media (max-width: 768px) {
    .hero-video-container {
        display: none;
    }

    .hero-section {
        background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('/assets/img/default_hero.png') !important;
        background-size: cover;
        background-position: center;
    }
}

/* Sections */
.news-section,
.services-section {
    padding: 60px 20px;
}

/* News List */
.news-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.news-date {
    color: #888;
    font-size: 0.9rem;
}

/* Service Grid */
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.service-card {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s;
}

.service-card:hover {
    transform: translateY(-5px);
}

.service-card h3 {
    color: var(--color-primary);
    margin-bottom: 15px;
}

.service-card p {
    margin-bottom: 20px;
    line-height: 1.6;
}

.link-arrow {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: bold;
}

.link-arrow::after {
    content: ' ->';
}

/* Real Estate Detail Styles (Extracted) */
.re-title {
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
    margin-bottom: 30px;
}

.re-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.re-main-img {
    background: #eee;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.re-main-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-price {
    font-size: 2rem;
    color: #c0392b;
    font-weight: bold;
    margin: 0 0 10px;
}

.detail-status {
    display: inline-block;
    background: #999;
    color: white;
    padding: 5px 10px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.detail-status.available {
    background: var(--color-accent);
}

.detail-data {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
}

.detail-data dt {
    font-weight: bold;
}

.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 30px 0;
}

.btn-block {
    text-align: center;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.share-area {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.btn-sm {
    padding: 5px 10px;
    background: #ddd;
    font-size: 0.8rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    color: #333;
}

@media (max-width: 768px) {
    .re-detail-grid {
        grid-template-columns: 1fr;
    }
}


/* Design Tokens (Spacing & Fonts) - Appended */
:root {
    --space-xs: 5px;
    --space-sm: 10px;
    --space-md: 20px;
    --space-lg: 40px;
    --space-xl: 60px;

    --font-sm: 0.8rem;
    --font-md: 1rem;
    --font-lg: 1.2rem;
    --font-xl: 1.5rem;
    --font-xxl: 2rem;
}

/* Submenu Styles */
.nav-list li {
    position: relative;
}

.nav-list .submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--color-bg);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-radius: 4px;
    padding: 10px 0;
    border: 1px solid #eee;
}

.nav-list li:hover>.submenu,
.nav-list li:focus-within>.submenu {
    display: block;
}

.nav-list .submenu li {
    width: 100%;
}

.nav-list .submenu a {
    display: block;
    padding: 10px 20px;
    font-size: 0.95em;
    white-space: nowrap;
}

.nav-list .submenu a:hover {
    background-color: var(--color-light-gray);
    color: var(--color-accent);
}