/* ============================================================
   Black's Law Dictionary (1910) - Stylesheet
   ============================================================ */

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

:root {
    --primary: #1e3a5f;
    --primary-dark: #152a45;
    --accent: #8b6914;
    --accent-light: #c9a227;
    --bg: #faf8f3;
    --bg-alt: #f0ece0;
    --text: #2c2c2c;
    --text-light: #5c5c5c;
    --border: #d4cfc0;
    --white: #ffffff;
    --success: #2d5a27;
    --note-bg: #eef4f7;
    --modern-bg: #f0f7e8;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
}

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

/* ---------- Header ---------- */
.site-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 2rem 0;
    border-bottom: 4px solid var(--accent);
}

.site-header h1 {
    font-size: 1.8rem;
    font-weight: normal;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.site-header .tagline {
    font-style: italic;
    opacity: 0.85;
    font-size: 0.95rem;
}

.site-header a {
    color: var(--white);
    text-decoration: none;
}

/* ---------- Navigation ---------- */
.main-nav {
    background: var(--primary-dark);
    padding: 0.6rem 0;
}

.main-nav a {
    color: var(--white);
    text-decoration: none;
    margin-right: 1.5rem;
    font-size: 0.95rem;
    opacity: 0.9;
}

.main-nav a:hover {
    opacity: 1;
    color: var(--accent-light);
}

/* ---------- Search Section ---------- */
.search-section {
    background: var(--bg-alt);
    padding: 2rem 0;
    border-bottom: 1px solid var(--border);
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 700px;
    margin: 0 auto;
}

.search-form input[type="text"] {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    background: var(--white);
}

.search-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

.search-form button {
    padding: 14px 28px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.search-form button:hover {
    background: var(--primary-dark);
}

/* ---------- A-Z Navigation ---------- */
.az-nav {
    padding: 1.5rem 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.az-nav h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 0.8rem;
}

.az-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.az-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-alt);
    color: var(--primary);
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: all 0.2s;
}

.az-links a:hover,
.az-links a.active {
    background: var(--primary);
    color: var(--white);
}

.az-links a.empty {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ---------- Main Content ---------- */
.main-content {
    padding: 2rem 0;
    min-height: 500px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2rem;
}

@media (max-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Term Cards ---------- */
.term-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.term-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.term-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.term-card h3 {
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.term-card h3 a {
    color: var(--primary);
    text-decoration: none;
}

.term-card h3 a:hover {
    color: var(--accent);
}

.term-card .pronunciation {
    font-style: italic;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.term-card .definition-preview {
    color: var(--text);
    margin-bottom: 0.8rem;
}

.term-card .meta {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.term-card .meta span {
    background: var(--bg-alt);
    padding: 2px 10px;
    border-radius: 12px;
}

/* ---------- Single Term View ---------- */
.term-full {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2.5rem;
}

.term-full .term-header {
    border-bottom: 2px solid var(--accent);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.term-full h1 {
    color: var(--primary);
    font-size: 2.2rem;
    margin-bottom: 0.3rem;
}

.term-full .pronunciation {
    font-style: italic;
    color: var(--text-light);
    font-size: 1.1rem;
}

.term-full .section {
    margin-bottom: 2rem;
}

.term-full .section h2 {
    color: var(--primary-dark);
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.term-full .definition-text {
    font-size: 1.05rem;
    line-height: 1.8;
}

.term-full .uk-notes {
    background: var(--note-bg);
    border-left: 4px solid var(--primary);
    padding: 1.2rem 1.5rem;
    border-radius: 0 6px 6px 0;
}

.term-full .uk-notes h2 {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.term-full .modern-update {
    background: var(--modern-bg);
    border-left: 4px solid var(--success);
    padding: 1.2rem 1.5rem;
    border-radius: 0 6px 6px 0;
}

.term-full .modern-update h2 {
    color: var(--success);
    border-bottom-color: var(--success);
}

.term-full .citations {
    font-style: italic;
    color: var(--text-light);
    font-size: 0.95rem;
}

.term-full .cross-refs a {
    display: inline-block;
    background: var(--bg-alt);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 4px;
    text-decoration: none;
    margin: 0 4px 4px 0;
    font-size: 0.9rem;
}

.term-full .cross-refs a:hover {
    background: var(--primary);
    color: var(--white);
}

.term-full .origin {
    color: var(--accent);
    font-style: italic;
}

/* ---------- Sidebar ---------- */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.3rem;
}

.sidebar-box h3 {
    color: var(--primary);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-box ul {
    list-style: none;
}

.sidebar-box ul li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--bg-alt);
}

.sidebar-box ul li:last-child {
    border-bottom: none;
}

.sidebar-box ul li a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
}

.sidebar-box ul li a:hover {
    color: var(--primary);
}

.sidebar-box .category-list a {
    display: block;
    color: var(--primary);
    text-decoration: none;
    padding: 0.3rem 0;
}

.sidebar-box .category-list a:hover {
    color: var(--accent);
}

/* ---------- Search Highlight ---------- */
mark.highlight {
    background: var(--accent-light);
    color: var(--primary-dark);
    padding: 1px 3px;
    border-radius: 2px;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.95rem;
}

.pagination a:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

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

/* ---------- Results Info ---------- */
.results-info {
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--primary-dark);
    color: var(--white);
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 4px solid var(--accent);
}

.site-footer .footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    opacity: 0.9;
}

@media (max-width: 700px) {
    .site-footer .footer-content {
        grid-template-columns: 1fr;
    }
}

.site-footer h4 {
    margin-bottom: 0.8rem;
    color: var(--accent-light);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.site-footer p {
    font-size: 0.9rem;
    line-height: 1.6;
}

.site-footer a {
    color: var(--white);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--accent-light);
}

.site-footer ul {
    list-style: none;
}

.site-footer ul li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

.copyright {
    text-align: center;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ---------- Public Domain Notice ---------- */
.pd-notice {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    font-size: 0.88rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 1rem;
}

/* ---------- Back Link ---------- */
.back-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.back-link:hover {
    color: var(--accent);
}

/* ---------- Print Styles ---------- */
@media print {
    .site-header, .main-nav, .search-section, .az-nav,
    .sidebar, .site-footer, .back-link {
        display: none !important;
    }
    .main-content { padding: 0; }
    .content-grid { grid-template-columns: 1fr; }
    .term-full { border: none; padding: 0; }
    body { background: white; }
}
