/**
 * terms.css — Scoped Terms & Legal Styles
 * @version 2.1.0
 * 
 * FIXES:
 * - All styles scoped to .terms-page to prevent global pollution
 * - Page title properly separated from navigation
 * - No interference with header/menu styles
 * - Fixed print and responsive behavior
 */

/* ==========================
   Per-page variables (scoped)
   ========================== */
.terms-page {
    --max-width: 980px;
    --container-padding: 28px;
    --section-spacing: 48px;
    --gap: 1rem;

    --accent-green: #0b6b3a;
    --accent-green-hover: #148a49;
    --accent-green-light: rgba(11, 107, 58, 0.06);
    --text-primary: #222;
    --text-secondary: #333;
    --text-muted: #7a7a7a;
    --text-dark: #0e3529;
    --surface: #ffffff;
    --surface-alt: #fafafc;
    --border-color: #e8e8e8;
    --border-light: rgba(0, 0, 0, 0.04);

    --shadow-sm: 0 2px 8px rgba(10, 20, 30, 0.04);
    --shadow-md: 0 8px 26px rgba(11, 107, 58, 0.04);
    --shadow-lg: 0 10px 28px rgba(10, 20, 30, 0.03);

    --warning-bg: linear-gradient(180deg, #fff5f0, #fffaf8);
    --warning-border: rgba(212, 110, 30, 0.08);
    --warning-text: #6b2c05;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;

    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-weight-normal: 400;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-black: 800;
    --font-weight-heavy: 900;

    --transition-fast: 150ms cubic-bezier(0.2, 0.9, 0.2, 1);
    --transition-base: 220ms cubic-bezier(0.2, 0.9, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

/* ==========================
   Scoped Reset
   ========================== */
.terms-page *,
.terms-page *::before,
.terms-page *::after {
    box-sizing: border-box;
}

/* Screen reader utility */
.terms-page .screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    word-wrap: normal !important;
}
.terms-page .screen-reader-text:focus {
    background-color: var(--surface);
    clip: auto !important;
    clip-path: none;
    color: var(--accent-green);
    display: block;
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.terms-page .skip-link {
    background-color: var(--accent-green);
    color: white;
    padding: 12px 20px;
    text-decoration: none;
    font-weight: var(--font-weight-bold);
    border-radius: 6px;
}
.terms-page .skip-link:focus {
    background-color: var(--accent-green-hover);
    color: white;
    outline: 3px solid var(--accent-green-light);
    outline-offset: 3px;
}

/* ==========================
   Main Container
   ========================== */
.terms-page {
    background: var(--surface);
    min-height: 100vh;
}

.terms-page .terms-privacy-container {
    max-width: var(--max-width);
    margin: var(--section-spacing) auto;
    padding: var(--container-padding);
    background: transparent;
    color: var(--text-primary);
}

/* ==========================
   Header Section (PAGE TITLE)
   ========================== */
.terms-page .terms-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
}

.terms-page .terms-title {
    margin: 0 0 0.75rem 0;
    font-weight: var(--font-weight-heavy);
    color: var(--accent-green);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.terms-page .terms-meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: var(--font-weight-normal);
}
.terms-page .terms-meta time { 
    font-style: normal; 
}

/* ==========================
   Table of Contents
   ========================== */
.terms-page .terms-toc {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 252, 253, 0.98));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0 2rem 0;
    box-shadow: var(--shadow-sm);
}

.terms-page .toc-title {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: var(--font-weight-black);
    color: var(--text-dark);
    border: none;
    padding: 0;
    background: none;
}

.terms-page .terms-toc ol {
    margin: 0;
    padding-left: 1.5rem;
    counter-reset: toc-counter;
    list-style: none;
}
.terms-page .terms-toc li {
    margin: 0.5rem 0;
    font-size: 0.95rem;
    counter-increment: toc-counter;
    position: relative;
}
.terms-page .terms-toc li::before {
    content: counter(toc-counter) ".";
    position: absolute;
    left: -1.5rem;
    color: var(--accent-green);
    font-weight: var(--font-weight-bold);
}

.terms-page .terms-toc a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: var(--font-weight-semibold);
    transition: color var(--transition-fast);
    display: inline-block;
}
.terms-page .terms-toc a:hover,
.terms-page .terms-toc a:focus {
    color: var(--accent-green);
    text-decoration: underline;
    outline: none;
}

/* ==========================
   Content Sections
   ========================== */
.terms-page .terms-content {
    line-height: 1.7;
    color: var(--text-primary);
}

.terms-page .terms-section {
    margin: 2rem 0;
    scroll-margin-top: 100px;
}

.terms-page .terms-section h2 {
    margin: 2rem 0 1rem 0;
    font-size: 1.2rem;
    font-weight: var(--font-weight-black);
    color: var(--text-dark);
    border-left: 4px solid var(--accent-green-light);
    padding: 0.5rem 0 0.5rem 1rem;
    background: linear-gradient(90deg, rgba(250, 250, 252, 0.3), transparent);
    border-radius: var(--radius-sm);
    position: relative;
}
.terms-page .terms-section h2::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 1rem;
    width: 40px;
    height: 2px;
    background: var(--accent-green);
    opacity: 0.3;
}

.terms-page .terms-section p {
    margin: 1rem 0;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
}
.terms-page .terms-section p:first-of-type { margin-top: 0; }
.terms-page .terms-section p:last-of-type { margin-bottom: 0; }

.terms-page .terms-section ul,
.terms-page .terms-section ol {
    margin: 1rem 0 1.25rem 1.5rem;
    padding: 0;
    color: var(--text-secondary);
    list-style-position: outside;
}
.terms-page .terms-section li {
    margin: 0.6rem 0;
    padding-left: 0.5rem;
}
.terms-page .terms-section ul li {
    list-style-type: disc;
}

.terms-page .terms-section strong { 
    color: var(--text-dark); 
    font-weight: var(--font-weight-bold); 
}
.terms-page .terms-section em { 
    font-style: italic; 
    color: var(--text-secondary); 
}

/* ==========================
   Warning Notice
   ========================== */
.terms-page .notice-warning {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    box-shadow: var(--shadow-lg);
    position: relative;
}
.terms-page .notice-warning::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #d46e1e, #ff9f5a);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.terms-page .warning-title { 
    margin:0 0 0.75rem 0; 
    color:var(--warning-text); 
    font-size:1.05rem; 
    font-weight:var(--font-weight-black); 
    display:flex;
    align-items:center;
    gap:0.5rem; 
}
.terms-page .notice-warning p { 
    margin:0.5rem 0; 
    color:var(--warning-text); 
    font-weight:var(--font-weight-semibold); 
    line-height:1.6; 
}

/* ==========================
   Links
   ========================== */
.terms-page .terms-content a {
    color: var(--accent-green);
    text-decoration: none;
    font-weight: var(--font-weight-bold);
    transition: color var(--transition-fast);
    position: relative;
}
.terms-page .terms-content a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-green-hover);
    transition: width var(--transition-base);
}
.terms-page .terms-content a:hover::after,
.terms-page .terms-content a:focus::after {
    width: 100%;
}
.terms-page .terms-content a:hover,
.terms-page .terms-content a:focus {
    color: var(--accent-green-hover);
    outline: none;
}
.terms-page .terms-content a[href^="http"]::before {
    content: '↗';
    display: inline-block;
    margin-right: 0.25rem;
    font-size: 0.85em;
    opacity: 0.6;
}

.terms-page .privacy-email {
    font-family: ui-monospace, 'Courier New', monospace;
    font-size: 0.9375em;
    padding: 0.125em 0.375em;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
}

/* ==========================
   Legal Block
   ========================== */
.terms-page .legal-block {
    margin: 1.5rem 0;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    background: linear-gradient(180deg, rgba(250, 250, 252, 1), rgba(245, 247, 250, 0.98));
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}
.terms-page .legal-block h3 { 
    margin:0 0 0.75rem 0; 
    font-size:1.1rem; 
    font-weight:var(--font-weight-black); 
    color:var(--accent-green); 
}
.terms-page .legal-block p { 
    margin:0.75rem 0; 
    font-size:0.98rem; 
    line-height:1.65; 
    color:var(--text-dark); 
}
.terms-page .legal-block p:first-of-type { 
    background: rgba(255, 255, 255, 0.7); 
    padding: 0.85rem 1rem; 
    border-radius: var(--radius-md); 
    border-left: 4px solid var(--accent-green); 
    box-shadow: var(--shadow-sm); 
}

/* ==========================
   Footer
   ========================== */
.terms-page .terms-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-light);
}

.terms-page .legal-note {
    margin: 0;
    padding: 1rem;
    background: var(--surface-alt);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.terms-page .legal-note strong {
    color: var(--accent-green);
    font-weight: var(--font-weight-bold);
}

/* ==========================
   Focus States
   ========================== */
.terms-page a:focus,
.terms-page button:focus,
.terms-page summary:focus {
    outline: 3px solid var(--accent-green-light);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
    transition: outline var(--transition-fast);
}
.terms-page a:focus:not(:focus-visible),
.terms-page button:focus:not(:focus-visible) { 
    outline: none; 
}
.terms-page a:focus-visible,
.terms-page button:focus-visible { 
    outline: 3px solid var(--accent-green); 
    outline-offset: 3px; 
}

/* ==========================
   WordPress-specific
   ========================== */
.terms-page .entry-header { display: none; }
.terms-page .entry-content { margin: 0; }
.terms-page .entry-footer { 
    margin-top: 2rem; 
    padding-top: 1rem; 
    border-top: 1px solid var(--border-light); 
}
.terms-page #comments { 
    margin-top: 3rem; 
    padding-top: 2rem; 
    border-top: 2px solid var(--border-light); 
}

/* ==========================
   High Contrast
   ========================== */
@media (prefers-contrast: high) {
    .terms-page {
        --accent-green: #085a2f;
        --border-color: #000;
        --text-muted: #555;
    }
    .terms-page .terms-section h2 { 
        border-left-width: 6px; 
    }
}

/* ==========================
   Reduced Motion
   ========================== */
@media (prefers-reduced-motion: reduce) {
    .terms-page *,
    .terms-page *::before,
    .terms-page *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================
   Print
   ========================== */
@media print {
    .terms-page {
        --accent-green: #000;
        --surface: #fff;
        --text-primary: #000;
        --text-secondary: #000;
    }

    .terms-page .terms-privacy-container { 
        margin: 0; 
        padding: 0; 
        max-width: 100%; 
    }
    .terms-page .terms-header { 
        border-bottom: 2px solid #000; 
    }
    .terms-page .terms-toc { 
        page-break-inside: avoid; 
        border: 1px solid #ccc; 
        background: transparent; 
        box-shadow: none; 
    }
    .terms-page .terms-section { 
        page-break-inside: avoid; 
    }
    .terms-page .terms-section h2 { 
        page-break-after: avoid; 
        border-left: 4px solid #000; 
        background: transparent; 
    }
    .terms-page .notice-warning { 
        border: 2px solid #000; 
        background: #f5f5f5; 
        box-shadow: none; 
        page-break-inside: avoid; 
    }
    .terms-page .legal-block { 
        border: 1px solid #ccc; 
        background: transparent; 
        box-shadow: none; 
    }
    .terms-page a { 
        text-decoration: underline; 
        color: #000; 
    }
    .terms-page a[href^="http"]::after { 
        content: " (" attr(href) ")"; 
        font-size: 0.85em; 
        color:#666; 
        word-wrap: break-word; 
    }
}

/* ==========================
   Responsive
   ========================== */
@media (max-width: 880px) {
    .terms-page {
        --container-padding: 20px;
        --section-spacing: 32px;
    }
    .terms-page .terms-privacy-container { 
        margin: var(--section-spacing) auto; 
        padding: var(--container-padding); 
    }
    .terms-page .terms-header { 
        margin-bottom: 1.5rem; 
        padding-bottom: 1rem; 
    }
    .terms-page .terms-title { 
        font-size: clamp(1.5rem, 3.5vw, 2rem); 
    }
    .terms-page .terms-section h2 { 
        font-size: 1.1rem; 
        padding-left: 0.85rem; 
    }
    .terms-page .terms-section p, 
    .terms-page .terms-section li { 
        font-size: 0.96rem; 
    }
    .terms-page .terms-toc { 
        padding: 1rem 1.25rem; 
    }
    .terms-page .notice-warning { 
        padding: 1rem 1.25rem; 
    }
    .terms-page .legal-block { 
        padding: 1rem; 
    }
}

@media (max-width: 640px) {
    .terms-page {
        --container-padding: 16px;
        --section-spacing: 24px;
    }
    .terms-page .terms-privacy-container { 
        margin: var(--section-spacing) auto; 
        padding: var(--container-padding); 
    }
    .terms-page .terms-header { 
        margin-bottom: 1.25rem; 
        padding-bottom: 0.75rem; 
    }
    .terms-page .terms-title { 
        font-size: 1.5rem; 
        letter-spacing: -0.3px; 
    }
    .terms-page .terms-meta { 
        font-size: 0.85rem; 
    }
    .terms-page .terms-toc { 
        padding: 0.85rem 1rem; 
        margin: 1rem 0 1.5rem 0; 
    }
    .terms-page .toc-title { 
        font-size: 1rem; 
        margin-bottom: 0.75rem; 
    }
    .terms-page .terms-toc ol { 
        padding-left: 1.25rem; 
    }
    .terms-page .terms-toc li { 
        font-size: 0.9rem; 
        margin: 0.4rem 0; 
    }
    .terms-page .terms-section { 
        margin: 1.5rem 0; 
        scroll-margin-top: 80px; 
    }
    .terms-page .terms-section h2 { 
        font-size: 1.05rem; 
        padding: 0.4rem 0 0.4rem 0.75rem; 
        margin: 1.5rem 0 0.85rem 0; 
    }
    .terms-page .terms-section h2::after { 
        width: 30px; 
        left: 0.75rem; 
    }
    .terms-page .terms-section p { 
        font-size: 0.94rem; 
        line-height: 1.65; 
    }
    .terms-page .terms-section ul, 
    .terms-page .terms-section ol { 
        margin-left: 1.25rem; 
    }
    .terms-page .notice-warning { 
        padding: 1rem; 
        margin: 1.25rem 0; 
    }
    .terms-page .warning-title { 
        font-size: 0.98rem; 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 0.25rem; 
    }
    .terms-page .notice-warning p { 
        font-size: 0.92rem; 
    }
    .terms-page .legal-block { 
        padding: 0.85rem; 
    }
    .terms-page .legal-block h3 { 
        font-size: 1rem; 
    }
    .terms-page .legal-block p { 
        font-size: 0.92rem; 
    }
    .terms-page .terms-footer { 
        margin-top: 2rem; 
        padding-top: 1.5rem; 
    }
    .terms-page .legal-note { 
        font-size: 0.9rem; 
    }
}

@media (max-width: 400px) {
    .terms-page { 
        --container-padding: 12px; 
    }
    .terms-page .terms-title { 
        font-size: 1.35rem; 
    }
    .terms-page .terms-section h2 { 
        font-size: 1rem; 
    }
    .terms-page .terms-toc { 
        padding: 0.75rem; 
    }
    .terms-page .notice-warning { 
        padding: 0.85rem; 
    }
}

/* ==========================
   Animations
   ========================== */
@media (prefers-reduced-motion: no-preference) {
    .terms-page .terms-section {
        opacity: 0;
        transform: translateY(20px);
        animation: termsFadeInUp 0.6s ease-out forwards;
    }
    .terms-page .terms-section:nth-child(1) { animation-delay: 0.1s; }
    .terms-page .terms-section:nth-child(2) { animation-delay: 0.15s; }
    .terms-page .terms-section:nth-child(3) { animation-delay: 0.2s; }
    .terms-page .terms-section:nth-child(n+4) { animation-delay: 0.25s; }

    @keyframes termsFadeInUp {
        to { opacity: 1; transform: translateY(0); }
    }
}