/*
 Theme Name:   RCP Child
 Theme URI:    https://rulesofcivilprocedure.com
 Description:  Custom child theme for Rules of Civil Procedure
 Author:       RCP
 Template:     generatepress
 Version:      1.1.7
*/

/* ===== GLOBAL STYLES ===== */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap');

body {
    background: #f5f1eb;
    color: #1a1a1a;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, 'Times New Roman', serif;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

*, *::before, *::after {
    box-sizing: border-box;
}

a {
    color: #1a1a1a;
    text-decoration: none;
}

/* ===== HOMEPAGE ===== */

.rcp-home {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rcp-home-header {
    width: 100%;
    max-width: 1100px;
    padding: 52px 24px 0;
    text-align: center;
}

.rcp-header-rule {
    width: 80px;
    height: 1px;
    background: #1a1a1a;
    margin: 0 auto 20px;
}

.rcp-home-header h1 {
    font-size: clamp(26px, 4.8vw, 48px);
    font-weight: 400;
    letter-spacing: 0.02em;
    margin: 0 0 6px;
    line-height: 1.2;
}

.rcp-home-header .rcp-subtitle {
    font-size: clamp(12px, 1.6vw, 15px);
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #777;
    margin-top: 10px;
}

.rcp-header-rule-bottom {
    width: 80px;
    height: 1px;
    background: #1a1a1a;
    margin: 20px auto 0;
}

/* Map */
.rcp-map-container {
    width: 100%;
    max-width: 960px;
    padding: 28px 20px;
    position: relative;
}

.rcp-map-container svg {
    width: 100%;
    height: auto;
}

.rcp-map-container svg path {
    cursor: pointer;
    transition: fill 0.2s ease, stroke 0.2s ease;
}

.rcp-map-tooltip {
    position: fixed;
    background: #1a1a1a;
    padding: 7px 16px;
    border-radius: 3px;
    pointer-events: none;
    z-index: 100;
    font-size: 14px;
    color: #f5f1eb;
    letter-spacing: 0.02em;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
    white-space: nowrap;
    display: none;
}

/* Federal Button */
.rcp-federal-btn {
    background: transparent;
    border: 1.5px solid #1a1a1a;
    color: #1a1a1a;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 13px 40px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
}

.rcp-federal-btn:hover {
    background: #1a1a1a;
    color: #f5f1eb;
}

/* State List */
.rcp-state-list-section {
    width: 100%;
    max-width: 960px;
    padding: 0 24px 64px;
}

.rcp-state-list-divider {
    border-top: 1px solid #ccc5b8;
    padding-top: 32px;
}

.rcp-state-list-title {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 20px;
    text-align: center;
}

.rcp-state-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1px 16px;
}

.rcp-state-list a {
    color: #666;
    font-size: 13px;
    padding: 5px 0;
    display: block;
    transition: all 0.2s ease;
}

.rcp-state-list a:hover {
    color: #1a1a1a;
    padding-left: 6px;
}

/* Footer is defined below, near scroll-to-top */

/* ===== STATE TOC PAGE ===== */

.rcp-toc {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.rcp-toc-header {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px 0;
    text-align: center;
    position: relative;
    box-sizing: border-box;
}

.rcp-back-btn {
    background: none;
    border: 1px solid #ccc5b8;
    color: #777;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    font-size: 12px;
    letter-spacing: 0.06em;
    padding: 6px 14px;
    border-radius: 3px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.rcp-back-btn:hover {
    border-color: #1a1a1a;
    color: #1a1a1a;
}

.rcp-toc-header h1 {
    font-size: clamp(24px, 4.5vw, 42px);
    font-weight: 400;
    letter-spacing: 0.02em;
    margin: 8px 0 0;
    line-height: 1.2;
}

.rcp-toc-header .rcp-toc-subtitle {
    font-size: clamp(11px, 1.5vw, 14px);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #777;
    margin-top: 8px;
}

/* Search */
.rcp-toc .rcp-search-wrapper {
    max-width: 900px;
    width: 100%;
    margin: 28px auto 0;
    padding: 0 24px;
    position: relative;
    box-sizing: border-box;
}

.rcp-toc .rcp-search-wrapper .rcp-search-input-wrap {
    position: relative;
    width: 100%;
    display: block;
}

.rcp-toc .rcp-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #999;
    z-index: 2;
    width: 18px;
    height: 18px;
}

.rcp-toc .rcp-search-input {
    display: block;
    width: 100%;
    max-width: none;
    padding: 15px 44px 15px 54px !important;
    margin: 0;
    background: #fff;
    border: 1px solid #ccc5b8;
    border-radius: 4px;
    color: #1a1a1a;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
    box-sizing: border-box;
    text-indent: 0;
}

.rcp-toc .rcp-search-input::placeholder {
    color: #aaa;
}

.rcp-toc .rcp-search-input:focus {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.rcp-toc .rcp-search-count {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    padding-left: 4px;
}

/* TOC Parts */
.rcp-toc-main {
    max-width: 900px;
    width: 100%;
    margin: 24px auto 0;
    padding: 0 24px 80px;
    flex: 1;
    box-sizing: border-box;
}

.rcp-part {
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #ddd8cf;
    border-radius: 4px;
    overflow: hidden;
}

.rcp-part-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    background: #faf8f4;
    border: none;
    cursor: pointer;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    font-size: clamp(15px, 2.2vw, 19px);
    font-weight: 400;
    color: #1a1a1a;
    text-align: left;
    transition: background 0.2s;
}

.rcp-part-header:hover {
    background: #f0ece4;
}

.rcp-part-header svg {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.rcp-part-header.expanded svg {
    transform: rotate(180deg);
}

.rcp-section-label {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #999;
    background: #faf8f4;
    border-bottom: 1px solid #eee8df;
}

.rcp-rule-link {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 16px;
    background: transparent;
    border-bottom: 1px solid #f0ece4;
    text-decoration: none;
    transition: all 0.2s ease;
}

.rcp-rule-link:hover {
    background: #f5f1eb;
    padding-left: 24px;
}

.rcp-rule-link:last-child {
    border-bottom: none;
}

.rcp-rule-num {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    min-width: 52px;
    flex-shrink: 0;
}

.rcp-rule-title {
    font-size: 14px;
    color: #555;
    line-height: 1.4;
}

/* ===== INDIVIDUAL RULE PAGE ===== */

.rcp-rule-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Two-column layout */
.rcp-rule-layout {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 40px;
    flex: 1;
}

.rcp-rule-main {
    flex: 1;
    min-width: 0;
}

.rcp-rule-header {
    padding: 32px 0 24px;
    text-align: left;
    border-bottom: 1px solid #ccc5b8;
    margin-bottom: 0;
}

.rcp-rule-jurisdiction {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 14px;
    font-style: italic;
}

.rcp-rule-header h1 {
    font-size: clamp(22px, 3.5vw, 32px);
    font-weight: 400;
    margin: 0 0 4px;
    line-height: 1.3;
}

.rcp-rule-header h2 {
    font-size: clamp(14px, 2vw, 18px);
    font-weight: 400;
    color: #555;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Rule content */
.rcp-rule-content {
    padding: 28px 0 48px;
    line-height: 1.85;
    font-size: 16px;
    color: #2a2a2a;
    text-align: justify;
}

.rcp-rule-content p {
    margin: 0 0 1.2em;
}

/* Indented subsections with hanging indent */
.rcp-rule-content .rule-indent-1 {
    padding-left: 2em;
    text-indent: -2em;
    margin: 0 0 0.8em;
    line-height: 1.75;
}

.rcp-rule-content .rule-indent-2 {
    padding-left: 4em;
    text-indent: -2em;
    margin: 0 0 0.8em;
    line-height: 1.75;
}

.rcp-rule-content .rule-indent-3 {
    padding-left: 6em;
    text-indent: -2em;
    margin: 0 0 0.8em;
    line-height: 1.75;
}

.rcp-rule-content .rule-indent-4 {
    padding-left: 8em;
    text-indent: -2em;
    margin: 0 0 0.8em;
    line-height: 1.75;
}

.rcp-rule-content .rule-label {
    font-weight: 700;
    display: inline;
}

/* Cross-reference links */
.rcp-rule-content a.rule-xref {
    color: #3a5a8c;
    text-decoration: underline;
    text-decoration-color: rgba(58, 90, 140, 0.3);
    text-underline-offset: 2px;
    transition: all 0.2s;
}

.rcp-rule-content a.rule-xref:hover {
    color: #1a3a6c;
    text-decoration-color: rgba(58, 90, 140, 0.7);
}

/* Structured content (legacy fallback) */
.rcp-rule-content .rule-structured {
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    white-space: pre-wrap;
    line-height: 1.75;
    margin: 0 0 1em;
    font-size: 16px;
}

/* Notes and Comments */
.rcp-rule-content .rule-notes {
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 2px solid #1a1a1a;
}

.rcp-rule-content .rule-notes-header {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 1em;
    color: #1a1a1a;
}

.rcp-rule-content .rule-notes p,
.rcp-rule-content .rule-notes .rule-structured,
.rcp-rule-content .rule-notes .rule-indent-1,
.rcp-rule-content .rule-notes .rule-indent-2,
.rcp-rule-content .rule-notes .rule-indent-3,
.rcp-rule-content .rule-notes .rule-indent-4 {
    font-size: 14px;
    color: #555;
    line-height: 1.7;
    text-align: left;
}

.rcp-rule-content .rule-notes .rule-indent-1,
.rcp-rule-content .rule-notes .rule-indent-2,
.rcp-rule-content .rule-notes .rule-indent-3,
.rcp-rule-content .rule-notes .rule-indent-4 {
    padding-left: 0;
    text-indent: 0;
    margin-left: 0;
}

/* Sidebar */
.rcp-rule-sidebar {
    width: 240px;
    flex-shrink: 0;
    padding-top: 32px;
}

.rcp-sidebar-inner {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rcp-sidebar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #ddd8cf;
    border-radius: 4px;
    color: #555;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    width: 100%;
    line-height: 1.4;
}

.rcp-sidebar-btn:hover {
    border-color: #1a1a1a;
    color: #1a1a1a;
}

.rcp-sidebar-btn svg {
    flex-shrink: 0;
}

.rcp-sidebar-btn strong {
    font-weight: 700;
    color: #1a1a1a;
}

.rcp-sidebar-toc {
    background: #faf8f4;
    font-weight: 400;
}

.rcp-sidebar-divider {
    height: 1px;
    background: #eee8df;
    margin: 4px 0;
}

.rcp-sidebar-label {
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #999;
    padding: 0 4px;
}

.rcp-sidebar-font {
    display: flex;
    align-items: center;
    border: 1px solid #ddd8cf;
    border-radius: 4px;
    overflow: hidden;
}

.rcp-sidebar-font .rcp-font-btn {
    flex: 1;
    background: #fff;
    border: none;
    border-right: 1px solid #ddd8cf;
    color: #555;
    font-size: 13px;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    text-align: center;
}

.rcp-sidebar-font .rcp-font-btn:last-child {
    border-right: none;
}

.rcp-sidebar-font .rcp-font-btn:hover {
    background: #f0ece4;
    color: #1a1a1a;
}

.rcp-sidebar-font .rcp-font-label {
    font-size: 11px;
    color: #999;
    padding: 0 8px;
    min-width: 44px;
    text-align: center;
    border-right: 1px solid #ddd8cf;
}

/* Sidebar nav links */
.rcp-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border: 1px solid #ddd8cf;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}

.rcp-sidebar-nav:hover {
    border-color: #1a1a1a;
    background: #faf8f4;
}

.rcp-sidebar-nav .rcp-nav-direction {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #999;
}

.rcp-sidebar-nav .rcp-nav-rule {
    font-size: 13px;
    color: #1a1a1a;
    font-weight: 700;
}

.rcp-sidebar-nav .rcp-nav-title {
    font-size: 11px;
    color: #777;
    line-height: 1.3;
}

/* Share modal */
.rcp-share-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.rcp-share-modal {
    background: #fff;
    border-radius: 6px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.rcp-share-modal h3 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 400;
}

.rcp-share-modal input[type="email"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc5b8;
    border-radius: 3px;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
}

.rcp-share-modal input[type="email"]:focus {
    border-color: #1a1a1a;
}

.rcp-share-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.rcp-share-send {
    background: #1a1a1a;
    color: #f5f1eb;
    border: none;
    padding: 9px 24px;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    font-size: 13px;
}

.rcp-share-cancel {
    background: transparent;
    color: #777;
    border: 1px solid #ccc5b8;
    padding: 9px 20px;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    font-size: 13px;
}

/* Copied tooltip */
.rcp-copied-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #f5f1eb;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 13px;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    animation: toastFade 2s forwards;
}

@keyframes toastFade {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Sidebar search */
.rcp-rule-sidebar .rcp-sidebar-search-wrap {
    position: relative;
    width: 100%;
}

.rcp-rule-sidebar .rcp-sidebar-search-wrap svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 2;
    width: 13px;
    height: 13px;
}

.rcp-rule-sidebar .rcp-sidebar-search {
    width: 100%;
    padding: 9px 10px 9px 32px !important;
    background: #fff;
    border: 1px solid #ddd8cf;
    border-radius: 4px;
    font-family: 'Libre Baskerville', 'Century Schoolbook', Georgia, serif;
    font-size: 12px;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    text-indent: 0;
}

.rcp-rule-sidebar .rcp-sidebar-search:focus {
    border-color: #1a1a1a;
}

.rcp-rule-sidebar .rcp-sidebar-search::placeholder {
    color: #aaa;
}

/* Search suggestions dropdown */
.rcp-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc5b8;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 10;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.rcp-search-suggestions.visible {
    display: block;
}

.rcp-search-suggestion {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #f0ece4;
    text-decoration: none;
    transition: background 0.15s;
}

.rcp-search-suggestion:hover,
.rcp-search-suggestion.active {
    background: #faf8f4;
}

.rcp-search-suggestion:last-child {
    border-bottom: none;
}

.rcp-search-suggestion .rcp-sugg-num {
    font-size: 12px;
    font-weight: 700;
    color: #1a1a1a;
    min-width: 40px;
    flex-shrink: 0;
}

.rcp-search-suggestion .rcp-sugg-title {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}

.rcp-search-empty {
    padding: 12px;
    font-size: 11px;
    color: #999;
    text-align: center;
    font-style: italic;
}

/* Scroll to top */
.rcp-scroll-top {
    position: fixed;
    bottom: 260px;
    right: 360px;
    width: 44px;
    height: 44px;
    background: #fff;
    border: 1.5px solid #1a1a1a;
    border-radius: 4px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    box-shadow: 0 3px 14px rgba(0,0,0,0.15);
    z-index: 999;
    padding: 0;
}

.rcp-scroll-top:hover {
    background: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgba(0,0,0,0.22);
}

.rcp-scroll-top:hover svg polyline {
    stroke: #f5f1eb;
}

.rcp-scroll-top.visible {
    display: flex;
}

.rcp-scroll-top svg polyline {
    stroke: #1a1a1a;
    transition: stroke 0.25s;
}

/* Faint .com TLD suffix */
.rcp-tld {
    font-size: 0.42em;
    color: #bbb;
    font-weight: 400;
    letter-spacing: 0.02em;
    margin-left: 3px;
    vertical-align: baseline;
    font-style: normal;
}

.rcp-tld-banner {
    font-size: 10px;
    color: #999;
    font-weight: 400;
    letter-spacing: 0.04em;
    margin-left: 2px;
    vertical-align: baseline;
}

/* Footer */
.rcp-footer {
    width: 100%;
    border-top: 1px solid #ccc5b8;
    padding: 20px 32px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
}

.rcp-footer-center {
    text-align: center;
    font-size: 12px;
    color: #999;
    letter-spacing: 0.04em;
    grid-column: 2;
}

.rcp-footer-support {
    font-size: 12px;
    color: #888;
    grid-column: 1;
    justify-self: start;
    max-width: 320px;
    line-height: 1.5;
    letter-spacing: 0;
}

.rcp-footer-support a {
    color: #666;
    text-decoration: underline;
    text-decoration-color: rgba(0,0,0,0.2);
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.rcp-footer-support a:hover {
    color: #1a1a1a;
    text-decoration-color: rgba(0,0,0,0.5);
}

.rcp-footer-disclaimer {
    font-size: 11px;
    color: #aaa;
    margin-top: 6px;
    font-style: italic;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1600px) {
    .rcp-scroll-top {
        bottom: 220px;
        right: 200px;
    }
}

@media (max-width: 1400px) {
    .rcp-scroll-top {
        bottom: 180px;
        right: 100px;
    }
}

@media (max-width: 1024px) {
    .rcp-scroll-top {
        bottom: 120px;
        right: 40px;
    }
}

@media (max-width: 768px) {
    .rcp-scroll-top {
        bottom: 24px;
        right: 20px;
    }

    .rcp-footer {
        grid-template-columns: 1fr;
        padding: 20px 24px;
        gap: 8px;
    }

    .rcp-footer-center {
        grid-column: 1;
        order: 1;
    }

    .rcp-footer-support {
        grid-column: 1;
        order: 2;
        justify-self: center;
        text-align: center;
        max-width: 100%;
        margin-top: 4px;
    }

    .rcp-toc-header {
        padding-top: 24px;
    }

    .rcp-rule-layout {
        flex-direction: column;
        gap: 0;
    }

    .rcp-rule-sidebar {
        width: 100%;
        padding: 0 0 40px;
        border-top: 1px solid #ccc5b8;
    }

    .rcp-sidebar-inner {
        position: static;
        padding-top: 20px;
    }

    .rcp-rule-toolbar {
        gap: 8px;
    }

    .rcp-rule-nav {
        flex-direction: column;
    }

    .rcp-nav-link {
        max-width: 100%;
    }

    .rcp-nav-link.next {
        align-items: flex-start;
    }
}
