/* --- WEBDEZ Legacy Design System (Modernized) --- */

:root {
    --primary-cyan: #00aeef;
    --bg-gray: #eeeeee;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #dddddd;
    --sidebar-header: #222222;
    --container-width: 1100px;
}

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

body {
    background-color: var(--bg-gray);
    color: var(--text-dark);
    font-family: "Hiragino Kaku Gothic ProN", "Meiryo", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}

a {
    color: var(--primary-cyan);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #0089bd;
}

/* --- Layout --- */
.header-container,
.breadcrumb-container,
.hero-container,
.layout-container,
.footer-container {
    max-width: var(--container-width);
    margin: 0 auto;
    width: 95%;
}

/* --- Header --- */
.site-header {
    background: #fff;
    padding: 20px 0;
    border-bottom: 3px solid var(--primary-cyan);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.site-logo img {
    height: 36px;
    display: block;
}

/* Hamburger UI */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-dark);
    padding: 5px;
}

@media (max-width: 800px) {
    .menu-toggle {
        display: block;
    }

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

/* --- Breadcrumbs --- */
.breadcrumb-bar {
    background: #333;
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
}

.breadcrumb-list {
    display: flex;
    list-style: none;
}

.breadcrumb-list li {
    position: relative;
    display: flex;
    align-items: center;
}

.breadcrumb-list li a,
.breadcrumb-list li.current {
    padding: 10px 20px 10px 30px;
    display: block;
    color: #fff;
}

.breadcrumb-list li:first-child a {
    padding-left: 15px;
}

/* Arrow Shapes */
.breadcrumb-list li::after {
    content: "";
    position: absolute;
    right: -10px;
    top: 0;
    width: 0;
    height: 0;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
    border-left: 10px solid #333;
    z-index: 2;
}

.breadcrumb-list li:hover::after {
    border-left-color: #444;
}

.breadcrumb-list li a:hover {
    background: #444;
}

.breadcrumb-list li.current {
    background: var(--primary-cyan);
}

.breadcrumb-list li.current::after {
    border-left-color: var(--primary-cyan);
}

/* --- Hero Area --- */
.hero-area {
    background: #222 url('../img/sub/top001.webp') no-repeat center center;
    background-size: cover;
    color: #fff;
    padding: 60px 0;
    border-bottom: 1px solid #000;
}

.hero-content {
    max-width: 800px;
}

.hero-category {
    font-size: 0.9rem;
    letter-spacing: 2px;
    opacity: 0.8;
    margin-bottom: 5px;
}

.hero-subcategory {
    font-size: 1.2rem;
    color: var(--primary-cyan);
    font-weight: bold;
    margin-bottom: 15px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 15px;
    font-family: 'Outfit', sans-serif;
}

.hero-title span {
    font-size: 1.5rem;
    font-weight: normal;
    margin-left: 10px;
}

.hero-desc {
    font-size: 1.1rem;
    opacity: 0.9;
}

.hero-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.playground-trigger,
.legacy-btn-primary {
    background: var(--primary-cyan);
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 4px 0 #0089bd;
    transition: all 0.2s;
    display: inline-block;
}

.playground-trigger:hover,
.legacy-btn-primary:hover {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #0089bd;
    color: #fff;
}

/* --- Main content --- */
.main-wrapper {
    padding: 40px 0;
}

.layout-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 30px;
}

.content-box {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.content-body,
.evo-body,
.a11y-box,
.point-list li {
    line-height: 1.8;
    /* 行間を広げて読みやすく */
}

.content-h {
    font-size: 1.4rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
    color: #000;
}

.content-h::before {
    content: "■";
    color: var(--primary-cyan);
    margin-right: 10px;
}

/* --- Point Box Sash --- */
.point-box {
    border: 2px solid var(--primary-cyan);
}

.sash-ribbon {
    position: absolute;
    top: 15px;
    left: -40px;
    background: var(--primary-cyan);
    color: #fff;
    width: 150px;
    text-align: center;
    transform: rotate(-45deg);
    font-weight: bold;
    font-size: 0.9rem;
    padding: 5px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.point-list {
    list-style: none;
    padding-left: 10px;
}

.point-list li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 15px;
    font-weight: bold;
}

.point-list li::before {
    content: "\2713";
    /* Checkmark */
    position: absolute;
    left: 0;
    color: var(--primary-cyan);
    font-size: 1.4rem;
    line-height: 1.2;
}

/* --- Code Blocks --- */
.code-wrapper {
    background: #f8f9fa;
    border-radius: 5px;
    padding: 20px;
    margin-top: 15px;
    position: relative;
    border: 1px solid #e9ecef;
}

.code-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
}

.copy-btn,
.try-btn {
    padding: 5px 12px;
    font-size: 0.75rem;
    border-radius: 3px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
}

.try-btn {
    background: var(--primary-cyan);
    color: #fff;
    border-color: var(--primary-cyan);
}

pre {
    background: #f4f4f4;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    border-left: 4px solid #ccc;
    box-sizing: border-box;
    width: 100%;
}

pre code {
    display: block;
    width: max-content;
    min-width: 100%;
}

.code-sublabel {
    font-size: 0.7rem;
    font-weight: bold;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 5px;
}

/* --- Technical Reference Table --- */
.table-wrapper {
    margin-bottom: 40px;
    overflow-x: auto;
}

.reference-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 500px;
}

.reference-table th {
    background: #f4f4f4;
    border-bottom: 2px solid var(--primary-cyan);
    padding: 12px 15px;
    text-align: left;
    font-size: 0.9rem;
}

.reference-table td {
    border-bottom: 1px solid #eee;
    padding: 12px 15px;
    font-size: 0.95rem;
}

.table-key code {
    color: var(--primary-cyan);
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
}

/* --- Sidebar Classic (Still used for search/tags) --- */
.side-box {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.side-h {
    background: var(--sidebar-header);
    color: #fff;
    padding: 14px 20px;
    font-size: 0.95rem;
    font-weight: 800;
}

.side-body {
    padding: 20px;
}

.side-body.nosidepadding {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0px;
}

.side-search {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fcfcfc;
    transition: all 0.2s;
}

.side-search:focus {
    outline: none;
    border-color: var(--primary-cyan);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.1);
}

.side-list {
    list-style: none;
}

.side-list li a {
    display: block;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.side-list li:last-child a {
    border-bottom: none;
}

.side-list li a:hover {
    background: #f9f9f9;
    color: var(--primary-cyan);
    padding-left: 25px;
}

/* --- Sidebar Accordion Nav --- */
.side-nav-accordion {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.side-nav-category {
    border-bottom: 1px solid #eee;
}

.side-nav-category:last-child {
    border-bottom: none;
}

.side-nav-category summary {
    padding: 15px 20px;
    background: #fcfcfc;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    /* remove default arrow */
    transition: all 0.2s ease;
}

.side-nav-category summary::-webkit-details-marker {
    display: none;
    /* hide default arrow Safari */
}

.side-nav-category summary::after {
    content: "＋";
    font-size: 0.8rem;
    color: #999;
    transition: transform 0.3s ease;
}

.side-nav-category[open] summary {
    background: var(--primary-cyan);
    color: #fff;
}

.side-nav-category[open] summary::after {
    content: "ー";
    color: #fff;
}

.side-nav-category.closing .side-nav-content {
    grid-template-rows: 0fr !important;
}

.side-nav-category summary:hover:not([open]) {
    background: #f4f4f4;
    color: var(--primary-cyan);
}

/* するするアニメーション */
.side-nav-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    overflow: hidden;
}

.side-nav-category[open] .side-nav-content {
    grid-template-rows: 1fr;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.side-nav-links {
    list-style: none;
    padding: 8px 0;
    min-height: 0;
    /* Important for grid-template-rows: 1fr to work */
}

.side-nav-links li a {
    display: block;
    padding: 10px 20px 10px 30px;
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.side-nav-links li a::before {
    content: "•";
    position: absolute;
    left: 18px;
    color: #ddd;
}

.side-nav-links li a:hover {
    background: #f0f9ff;
    color: var(--primary-cyan);
    padding-left: 35px;
}

.side-nav-links li a.active {
    background: #e6f7ff;
    color: var(--primary-cyan);
    font-weight: bold;
}

.side-group ul {
    list-style: none;
    margin-top: 10px;
}

.side-group ul li a {
    padding: 5px 0 5px 15px;
    border: none;
    font-weight: normal;
}

/* --- Browser Support (Sidebar) --- */
.browser-support {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.support-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.support-ver {
    font-size: 0.8rem;
    font-weight: bold;
}

/* --- Tags (Sidebar) --- */
.card-tag {
    display: inline-block;
    background: #eee;
    padding: 3px 8px;
    margin: 3px;
    font-size: 0.75rem;
    border-radius: 3px;
    color: #555;
    border: 1px solid #ddd;
}

/* --- Footer --- */
.site-footer {
    background: #333;
    color: #aaa;
    padding: 30px 0;
    text-align: center;
    font-size: 0.85rem;
}

/* --- Playground Modal --- */
.playground-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.playground-modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    width: 95%;
    height: 90%;
    max-width: 1400px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    background: #f4f4f4;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

.modal-close {
    font-size: 2rem;
    cursor: pointer;
}

.playground-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 0;
}

.editor-side {
    display: flex;
    flex-direction: column;
    background: #282c34;
    padding: 20px;
    gap: 20px;
}

.editor-block {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-block label {
    color: #abb2bf;
    font-size: 0.75rem;
    margin-bottom: 5px;
    font-weight: bold;
}

.editor-block textarea {
    flex: 1;
    background: #1e2127;
    color: var(--primary-cyan);
    border: 1px solid #3e4451;
    padding: 15px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    resize: none;
    border-radius: 5px;
}

.preview-side {
    background: #eee;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.preview-side label {
    font-size: 0.75rem;
    margin-bottom: 5px;
    font-weight: bold;
}

.preview-side iframe {
    flex: 1;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.modal-footer {
    padding: 10px 25px;
    background: #f4f4f4;
    font-size: 0.8rem;
    text-align: right;
    border-top: 1px solid #ddd;
}

/* --- New Depth Sections (A11y, Evolution) --- */

.a11y-box {
    border-left: 5px solid #ffcc00;
}

.nesting-box {
    border-left: 5px solid #29a9df;
}

.evolution-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    margin-top: 10px;
}

.evolution-item {
    padding: 20px;
    border-radius: 8px;
    position: relative;
    border: 1px solid #ddd;
}

.evolution-item.legacy {
    background: #fdfdfd;
    border-left: 4px solid #999;
}

.evolution-item.modern {
    background: #f0faff;
    border-left: 4px solid var(--primary-cyan);
}

.evo-label {
    font-size: 0.7rem;
    font-weight: bold;
    color: #999;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.evolution-item.modern .evo-label {
    color: var(--primary-cyan);
}

.evo-body {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.5;
}

/* --- TOP Page Specific (Legacy) --- */

.dictionary-grid-legacy {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.legacy-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.legacy-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-cyan);
}

.legacy-card .card-type {
    font-size: 0.7rem;
    font-weight: bold;
    color: #fff;
    background: #999;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    align-self: flex-start;
    margin-bottom: 10px;
}

.legacy-card .card-type.html {
    background: #f16529;
}

.legacy-card .card-type.css {
    background: #29a9df;
}

.legacy-card .card-title {
    font-size: 1.3rem;
    color: #000;
    margin-bottom: 8px;
}

.legacy-card .card-desc {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.legacy-card .card-preview {
    background: #f8f8f8;
    padding: 10px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--primary-cyan);
    margin-top: auto;
    border: 1px solid #eee;
}

/* --- Filter Toolbar Legacy --- */
.filter-toolbar-legacy {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.search-container-legacy {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-container-legacy::before {
    content: "🔍";
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 1rem;
    pointer-events: none;
    z-index: 5;
}

.search-container-legacy input#searchInput {
    width: 100%;
    padding: 14px 20px 14px 50px;
    border: 2px solid #eee;
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.search-container-legacy input#searchInput:focus {
    outline: none;
    border-color: var(--primary-cyan);
    box-shadow: 0 8px 20px rgba(0, 174, 239, 0.15);
    transform: translateY(-2px);
}

.filter-btns-legacy {
    display: flex;
    gap: 10px;
}

.filter-btns-legacy .filter-btn {
    padding: 10px 20px;
    border: 2px solid #eee;
    background: #fff;
    cursor: pointer;
    font-size: 0.95rem;
    border-radius: 50px;
    font-weight: 600;
    color: #666;
    transition: all 0.2s ease;
}

.filter-btns-legacy .filter-btn:hover {
    border-color: #ddd;
    color: var(--primary-cyan);
    background: #f8f9fa;
}

.filter-btns-legacy .filter-btn.active {
    background: var(--primary-cyan);
    color: #fff;
    border-color: var(--primary-cyan);
    box-shadow: 0 4px 10px rgba(0, 174, 239, 0.3);
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee;
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-cyan);
}

/* --- FINAL RESPONSIVE OVERRIDES --- */
@media (max-width: 800px) {
    .layout-container {
        display: block !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .primary-content {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        display: block !important;
        margin: 0 !important;
    }

    .hero-title {
        font-size: 2.5rem !important;
    }

    .hero-container {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .playground-trigger {
        margin-top: 20px;
    }

    .evolution-grid {
        grid-template-columns: 1fr !important;
    }

    .filter-toolbar-legacy {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
    }

    .search-container-legacy {
        width: 100% !important;
        min-width: 0 !important;
    }

    .filter-btns-legacy {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* SIDEBAR DRAWER */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        right: -320px !important;
        width: 280px !important;
        height: 100vh !important;
        background: #fff !important;
        z-index: 1000 !important;
        transition: right 0.3s ease !important;
        margin: 0 !important;
        padding: 20px !important;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1) !important;
        overflow-y: auto !important;
        display: block !important;
    }

    .sidebar.active {
        right: 0 !important;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .playground-grid {
        grid-template-columns: 1fr !important;
        overflow-y: auto;
    }

    .preview-side iframe {
        min-height: 300px;
    }
}