/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-family: system-ui, -apple-system, 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #0d2137;
    background: #f8f9fb;
}

body { min-height: 100vh; display: flex; flex-direction: column; }

a { color: #0066aa; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; width: 100%; }

/* ── Nav ──────────────────────────────────────────── */
.top-nav {
    background: #0d2137;
    padding: 0.6rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    color: #fff !important;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}
.nav-links a {
    color: rgba(255,255,255,0.8) !important;
    margin-left: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: #fff !important; }

/* ── Search Hero ──────────────────────────────────── */
.search-hero {
    text-align: center;
    padding: 3rem 0 2rem;
}
.search-hero.compact {
    padding: 1.5rem 0 1rem;
}
.search-hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.search-hero.compact h1 {
    font-size: 1.3rem;
}
.hero-sub {
    color: #556;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* ── Search Form ──────────────────────────────────── */
.search-form {
    max-width: 800px;
    margin: 0 auto;
}
.search-bar {
    display: flex;
    gap: 0;
}
.search-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1.05rem;
    border: 2px solid #c0c8d0;
    border-right: none;
    border-radius: 8px 0 0 8px;
    outline: none;
    background: #fff;
}
.search-bar input:focus { border-color: #0066aa; }
.search-bar button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: #0066aa;
    color: #fff;
    border: 2px solid #0066aa;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
}
.search-bar button:hover { background: #005590; border-color: #005590; }

/* ── Results ──────────────────────────────────────── */
.results-dual { padding: 0 0 2rem; }

/* ── Accordion Ribbon ────────────────────────────── */
.accordion { margin-bottom: 0.75rem; }

.ribbon {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d0d5da;
    border-radius: 6px;
    background: #f0f2f5;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0d2137;
    text-align: left;
    gap: 0.5rem;
}
.ribbon:hover { background: #e8ecf0; }
.ribbon.open {
    border-radius: 6px 6px 0 0;
    background: #e8f0f8;
    border-bottom-color: transparent;
}
.ribbon-arrow {
    width: 1rem;
    flex-shrink: 0;
    font-size: 0.75rem;
}
.ribbon-label {
    flex-shrink: 0;
    white-space: nowrap;
}
.ribbon-count { font-weight: 700; }

.ribbon-tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.btn-sort {
    padding: 0.25rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1.5px solid #c0c8d0;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    color: #667;
    white-space: nowrap;
}
.btn-sort:hover { border-color: #0066aa; color: #0066aa; }
.btn-sort.active { background: #0066aa; color: #fff; border-color: #0066aa; }
.sub-filter {
    margin-left: 0;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 400;
    border: 1.5px solid #c0c8d0;
    border-radius: 4px;
    background: #fff;
    outline: none;
    width: 180px;
    min-width: 0;
}
.sub-filter:focus { border-color: #0066aa; }
.sub-filter::placeholder { color: #aab; }

.ribbon-body {
    border: 1px solid #d0d5da;
    border-top: none;
    border-radius: 0 0 6px 6px;
    overflow-x: auto;
    max-height: 60vh;
    overflow-y: scroll;
    display: block;
}
.ribbon-body .results-table { margin-bottom: 0; }
.ribbon-body .results-table th:first-child,
.ribbon-body .results-table td:first-child { padding-left: 0.75rem; }
.ribbon-body .results-table thead th {
    position: sticky;
    top: 0;
    background: #f0f2f5;
    z-index: 1;
}

/* ── Clickable table rows ─────────────────────────── */
.law-row, .case-row { cursor: pointer; }
.law-row:hover, .case-row:hover { background: #dbeafe !important; }
.law-text-hidden { display: none; }

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active {
    display: flex;
}
.modal-box {
    background: #fff;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e8eaed;
    font-weight: 700;
    font-size: 1.05rem;
    color: #0d2137;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #667;
    padding: 0 0.25rem;
    line-height: 1;
}
.modal-close:hover { color: #0d2137; }
.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.8;
    color: #334;
}

.results-count {
    font-size: 0.9rem;
    color: #556;
    margin-bottom: 1rem;
}
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
}
.results-table th {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 2px solid #d0d5da;
    font-weight: 600;
    color: #334;
    white-space: nowrap;
}
.results-table td {
    padding: 0.55rem 0.5rem;
    border-bottom: 1px solid #e8eaed;
    vertical-align: top;
}
.results-table tbody tr:nth-child(even) { background: #f4f5f7; }
.results-table tbody tr:hover { background: #edf2f7; }

.mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.82rem; }
.nowrap { white-space: nowrap; }
.title-cell { max-width: 350px; }

.btn-view {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0066aa !important;
    border: 1px solid #0066aa;
    border-radius: 4px;
    white-space: nowrap;
}
.btn-view:hover { background: #0066aa; color: #fff !important; text-decoration: none; }

.no-results {
    text-align: center;
    padding: 2rem;
    color: #667;
}

/* ── (snippets removed — using accordion + modal) ── */

/* ── CTA Box ──────────────────────────────────────── */
.cta-box {
    background: #fff;
    border: 1px solid #d0d5da;
    border-radius: 10px;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
}
.cta-box h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}
.cta-box ul {
    list-style: none;
    padding: 0;
}
.cta-box li {
    padding: 0.3rem 0;
    padding-left: 1.2rem;
    position: relative;
}
.cta-box li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: #0a8;
    font-weight: 700;
}

/* ── Detail Page ──────────────────────────────────── */
.breadcrumb {
    font-size: 0.85rem;
    color: #667;
    padding: 1rem 0 0.5rem;
}
.breadcrumb a { color: #0066aa; }

.patent-detail { padding-bottom: 2rem; }
.patent-detail header { margin-bottom: 1.5rem; }
.patent-detail h1 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.75rem;
}
.patent-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    font-size: 0.88rem;
    color: #445;
}
.patent-section { margin-bottom: 1.5rem; }
.patent-section h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a3a5c;
    margin-bottom: 0.5rem;
}
.body-text {
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.8;
    background: #fff;
    border: 1px solid #d0d5da;
    border-radius: 8px;
    padding: 1.5rem;
}

/* ── Footer ───────────────────────────────────────── */
.site-footer {
    margin-top: auto;
    padding: 1.5rem 0;
    background: #0d2137;
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    text-align: center;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
    .search-hero h1 { font-size: 1.5rem; }
    .hero-sub { font-size: 0.95rem; }
    .patent-meta { flex-direction: column; gap: 0.3rem; }
    .results-table { font-size: 0.8rem; }
    .title-cell { max-width: 200px; }
    .sub-filter { width: 120px; }
    .modal-box { width: 95%; max-height: 85vh; }
}
@media (max-width: 480px) {
    .search-hero { padding: 1.5rem 0 1rem; }
    .search-hero h1 { font-size: 1.3rem; }
    .search-bar input { font-size: 0.95rem; padding: 0.6rem 0.75rem; }
    .search-bar button { padding: 0.6rem 1rem; }
    .patent-detail h1 { font-size: 1.2rem; }
}
