/*
Theme Name: Digital Horse
Theme URI: https://blog.sqhorse.com
Author: Digital Agency Style AI
Description: A simple, accessible theme based on Digital Agency Japan design system.
Version: 1.0
*/

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');

:root {
    /* Digital Agency Primitive Colors (Added by User) */
    --color-primitive-blue-50: #e8f1fe;
    --color-primitive-blue-100: #d9e6ff;
    --color-primitive-blue-200: #c5d7fb;
    --color-primitive-blue-300: #9db7f9;
    --color-primitive-blue-400: #7096f8;
    --color-primitive-blue-500: #4979f5;
    --color-primitive-blue-600: #3460fb;
    --color-primitive-blue-700: #264af4;
    --color-primitive-blue-800: #0031d8;
    --color-primitive-blue-900: #0017c1;
    --color-primitive-blue-1000: #00118f;

    /* Original Theme Variables */
    --primary-color: #005BAB;
    /* Digital Agency Blue */
    --accent-green: #00703C;
    /* Racing Turf Green */
    --accent-gold: #B58600;
    --jra-color: #00703C;
    --nar-color: #E95513;
    --text-color: #333333;
    --bg-color: #F8F9FA;
    --border-color: #E0E0E0;
    --white: #FFFFFF;
    --max-width: 1080px;
    --spacing-unit: 8px;

    /* Gate Colors */
    --gate-1: #FFFFFF;
    --gate-2: #222222;
    --gate-3: #C7243A;
    --gate-4: #0067C0;
    --gate-5: #E6B422;
    --gate-6: #008D4C;
    --gate-7: #ED6D1F;
    --gate-8: #E95295;
}

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

body {
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    text-decoration: underline;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--white) 0%, #f0f7ff 100%);
    border-bottom: 3px solid var(--accent-green);
    padding: calc(var(--spacing-unit) * 3) 0;
    position: relative;
    z-index: 50;
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 calc(var(--spacing-unit) * 2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: 0.05em;
}

.site-description {
    font-size: 0.875rem;
    color: #666;
    margin-left: 1rem;
}

/* Navigation */
.nav ul {
    display: flex;
    list-style: none;
    gap: calc(var(--spacing-unit) * 2);
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.nav li {
    position: relative;
    flex-shrink: 0;
}

.nav a {
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.95rem;
    display: block;
    padding: 5px 0;
    white-space: nowrap;
}

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

/* Parent Item Indicator (Desktop) */
.nav .menu-item-has-children>a::after {
    content: '';
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    /* Matches text color */
    transform: translateY(1px);
    /* Optical adjustment */
}

/* Submenu */
.nav ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    min-width: 200px;
    z-index: 999;
    padding: 10px;
    flex-direction: column;
    gap: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dropdown-toggle {
    display: none;
    /* Hidden on desktop */
}

.nav ul li:hover>ul {
    display: flex;
}

.nav ul ul li {
    width: 100%;
}

.nav ul ul a {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.nav ul ul a:hover {
    background-color: #f0f7ff;
}

/* Main */
.main-container {
    max-width: var(--max-width);
    margin: calc(var(--spacing-unit) * 6) auto;
    padding: 0 calc(var(--spacing-unit) * 2);
    display: flex;
    gap: calc(var(--spacing-unit) * 6);
}

.content-area {
    flex: 3;
}

.sidebar {
    flex: 1;
}

/* Sidebar Categories Hierarchy */
.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin-bottom: 0.5rem;
    position: relative;
}

.sidebar ul ul.children {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    border-left: 2px solid var(--border-color);
    padding-left: 0.5rem;
}

.sidebar a {
    color: var(--text-color);
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s;
}

.sidebar a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.sidebar li .count {
    font-size: 0.85em;
    color: #888;
    margin-left: 0.3em;
}

/* Widget Styles (Card Look) */
.widget {
    background: var(--white);
    padding: calc(var(--spacing-unit) * 3);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

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

.widget li {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.widget li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Pagination */
.pagination {
    margin: 2rem 0;
    text-align: center;
}

.pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.pagination .page-numbers.current {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.pagination .page-numbers:hover:not(.current) {
    background-color: #f0f7ff;
    border-color: var(--primary-color);
    text-decoration: none;
}

.pagination .prev,
.pagination .next {
    font-weight: 700;
}

/* Post List */
.post-list {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.post-item {
    padding: calc(var(--spacing-unit) * 3);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.post-item:last-child {
    border-bottom: none;
}

.post-item:hover {
    background-color: #fcfcfc;
}

.post-meta {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: calc(var(--spacing-unit));
    display: flex;
    gap: 1rem;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: calc(var(--spacing-unit));
    line-height: 1.4;
}

.post-title a {
    color: var(--text-color);
}

.post-excerpt {
    font-size: 1rem;
    color: #444;
}

/* Single Post */
.post-detail {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: calc(var(--spacing-unit) * 3);
    /* Unified with post-list (24px) */
}

.entry-header {
    margin-bottom: calc(var(--spacing-unit) * 4);
    padding-bottom: calc(var(--spacing-unit) * 2);
    border-bottom: 1px solid var(--border-color);
}

.entry-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.entry-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.entry-content h2 {
    font-size: 1.5rem;
    margin: 2em 0 1em;
    padding-bottom: 0.5em;
    border-bottom: 2px solid var(--primary-color);
}

.entry-content h3 {
    font-size: 1.25rem;
    margin: 1.5em 0 1em;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

.entry-content p {
    margin-bottom: 1.5em;
}

/* Content Elements Styling */
.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    /* Reverted to PC default */
}

.entry-content th {
    padding: 12px;
    border: 1px solid var(--border-color);
    background-color: #f2f2f2;
    font-weight: 700;
    text-align: left;
}

.entry-content td {
    padding: 12px;
    border: 1px solid var(--border-color);
    background-color: var(--white);
}

.entry-content tr:nth-child(even) td {
    background-color: #fafafa;
}

.entry-content ul,
.entry-content ol {
    margin: 1.5em 0;
    padding-left: 1.5em;
}

.entry-content li {
    margin-bottom: 0.5em;
}

.entry-content blockquote {
    border-left: 4px solid var(--border-color);
    margin: 1.5em 0;
    padding: 1em 1.5em;
    background-color: #f9f9f9;
    color: #555;
    font-style: italic;
}

.entry-content pre {
    background-color: #f5f5f5;
    padding: 1em;
    overflow-x: auto;
    border-radius: 4px;
    margin: 1.5em 0;
}

.entry-content code {
    font-family: monospace;
    background-color: #eee;
    padding: 2px 4px;
    border-radius: 2px;
}

/* Forms (Digital Agency System) */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
textarea,
select {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: calc(var(--spacing-unit) * 1.5);
    /* ~12px */
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--white);
    border: 1px solid #767676;
    /* Standard accessible gray */
    border-radius: 4px;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* Focus State - High Visibility */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 91, 171, 0.2);
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

::placeholder {
    color: #767676;
    opacity: 1;
}

/* Footer */
.footer {
    background-color: var(--white);
    border-top: 1px solid var(--border-color);
    padding: calc(var(--spacing-unit) * 4) 0;
    margin-top: auto;
    text-align: center;
    color: #666;
    font-size: 0.875rem;
}

/* Button */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 4px;
    font-weight: 500;
}

.btn:hover {
    background-color: #004a8f;
    text-decoration: none;
}

/* Utilities */
.tag {
    display: inline-block;
    padding: 2px 10px;
    background-color: #eee;
    border-radius: 99px;
    font-size: 0.75rem;
    color: #555;
    font-weight: 500;
}

.tag.g1 {
    background-color: var(--accent-gold);
    color: var(--white);
}

.tag.turf {
    background-color: var(--accent-green);
    color: var(--white);
}

.tag.jra {
    background-color: var(--jra-color);
    color: var(--white);
    border: 1px solid var(--jra-color);
}

.tag.nar {
    background-color: var(--white);
    color: var(--nar-color);
    border: 1px solid var(--nar-color);
    font-weight: 700;
}

.post-item.jra-race {
    border-left: 5px solid var(--jra-color);
}

.post-item.nar-race {
    border-left: 5px solid var(--nar-color);
}

/* Gate Numbers */
.gate-num {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 2px;
    color: #fff;
    font-weight: bold;
    font-size: 0.8rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.gate-num.gate-1 {
    background-color: var(--gate-1);
    color: #222;
    border: 1px solid #ccc;
    text-shadow: none;
}

.gate-num.gate-2 {
    background-color: var(--gate-2);
}

.gate-num.gate-3 {
    background-color: var(--gate-3);
}

.gate-num.gate-4 {
    background-color: var(--gate-4);
}

.gate-num.gate-5 {
    background-color: var(--gate-5);
}

.gate-num.gate-6 {
    background-color: var(--gate-6);
}

.gate-num.gate-7 {
    background-color: var(--gate-7);
}

.gate-num.gate-8 {
    background-color: var(--gate-8);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 100;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin-bottom: 5px;
    transition: all 0.3s;
}

.menu-toggle span:last-child {
    margin-bottom: 0;
}

.menu-open .menu-toggle span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-open .menu-toggle span:nth-child(2) {
    opacity: 0;
}

.menu-open .menu-toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}

body.menu-open {
    overflow: hidden;
}

.rank_f {
    color: #999;
}

.rank_e {
    color: #006400;
}

.rank_d {
    color: #1e90ff;
}

.rank_c {
    color: #ffa500;
}

.rank_b {
    color: #dc143c;
}

.rank_a {
    color: #ff1493;
}

.rank_s {
    color: #ff69b4;
}

.rank_ss {
    color: #ff69b4;
}

.box_note {
    padding: 0.5em 1em;
    margin: 1em 0;
    background: #f4f4f4;
    border-left: solid 6px #5bb7ae;
    box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.33);
}

.box_note p {
    margin: 0;
    padding: 0;
}

.box_note p:nth-child(n+1) {
    margin-top: 10px;
}

/* 注目ポイント */
.box_note ul {
    list-style-type: none;
    padding-left: 0;
}

.box_note ul li {
    margin-bottom: 10px;
}

/* 買い目表示 */
.kaime-box p {
    margin: 5px 0;
    padding: 5px;
    border-bottom: 1px dotted #ccc;
}

.kaime-box span {
    display: inline-block;
    background-color: #e7f3ff;
    color: #005a9c;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.9em;
    margin-left: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --spacing-unit: 6px;
    }

    body {
        font-size: 14px;
    }

    .header-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0 calc(var(--spacing-unit) * 1.5);
        flex-wrap: nowrap;
        /* Prevent menu button from wrapping */
    }

    .header {
        padding: calc(var(--spacing-unit) * 2) 0;
    }

    /* ... menu toggle styles remain ... */
    .menu-toggle {
        display: block;
        flex-shrink: 0;
        /* Protect button from shrinking */
    }

    .nav {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: var(--white);
        padding-top: 60px;
        /* Reduced top padding */
        z-index: 90;
        text-align: center;
    }

    .nav ul {
        flex-direction: column;
        gap: 1.5rem;
        /* Reduced gap */
        font-size: 1.0em;
        padding: 0;
    }

    /* ... animation ... */
    .nav.active {
        display: block;
        animation: fadeIn 0.3s ease-out;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    .main-container {
        display: block;
        margin-top: calc(var(--spacing-unit) * 1.5);
        /* Reduced margin further */
        padding: 0 4px;
        /* Minimal side padding (4px) */
    }

    .content-area {
        margin-bottom: 1rem;
    }

    .sidebar {
        width: 100%;
    }

    /* Compact Elements for Mobile - Unified minimal whitespace */
    .post-item,
    .post-detail,
    .widget {
        padding: 8px;
        /* Unified minimal padding */
        margin-bottom: -1px;
        /* Collapse borders */
    }

    .widget {
        margin-bottom: 1rem;
        /* Restore margin for widgets */
    }

    .post-meta {
        flex-wrap: wrap;
        gap: 0.3rem;
        margin-bottom: 0.5rem;
    }

    .post-title {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .post-excerpt {
        font-size: 0.9rem;
    }

    .entry-content table {
        display: table;
        /* Revert to normal table behavior to fill width */
        width: 100%;
        font-size: 0.75rem;
        /* Even smaller font */
        table-layout: auto;
        /* Allow auto sizing */
    }

    .entry-content th,
    .entry-content td {
        padding: 3px 4px;
        /* Minimal padding */
        word-break: break-all;
        /* Ensure long words break */
        overflow-wrap: break-word;
    }

    .entry-content th {
        white-space: normal;
        /* Allow headers to wrap */
        vertical-align: middle;
        background-color: #f2f2f2;
    }

    .entry-content td {
        white-space: normal;
        /* Allow data to wrap too if needed to fit */
        vertical-align: middle;
    }

    /* Mobile Menu Accordion */
    .nav ul ul {
        display: none;
        position: static;
        min-width: unset;
        width: 100%;
        box-shadow: none;
        border: none;
        border-left: 2px solid var(--border-color);
        padding-left: 1rem;
        background-color: transparent;
        animation: none;
    }

    .nav li.toggled-on>ul {
        display: block;
    }

    .nav ul li:hover>ul {
        display: none;
    }

    .nav li.toggled-on:hover>ul {
        display: block;
    }

    .dropdown-toggle {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        width: 44px;
        height: 40px;
        background: transparent;
        border: none;
        color: var(--primary-color);
        font-size: 1.2rem;
        cursor: pointer;
        z-index: 10;
        line-height: 40px;
    }

    .icon-plus::before {
        content: '+';
    }

    .icon-minus::before {
        content: '-';
        font-weight: bold;
    }

    .nav li {
        position: relative;
    }

    div.score-rank-table table th:nth-child(1),
    div.score-rank-table table th:nth-child(2),
    div.score-rank-table table th:nth-child(4),
    div.score-rank-table table th:nth-child(5),
    div.score-rank-table table th:nth-child(6),
    div.score-rank-table table th:nth-child(7),
    div.score-rank-table table th:nth-child(8),
    div.score-rank-table table th:nth-child(9),
    div.score-rank-table table th:nth-child(10) {
        /* 幅を固定したいサイズを設定します（例: 80px） */
        width: 35px;

        /* セル幅の固定を確実にするためのオプション（後述） */
        min-width: 35px;
        max-width: 35px;

        /* 3列目以外のすべてのthに適用するため、この書き方でOK */
    }

}