/*!
 * Cryptoix CMS Content Stylesheet  v1.0.0
 * Public CMS pages: Privacy, Terms, About, …
 * Uses CSS variables exposed by the active theme (--foreground, --muted-fg,
 * --card-border, --brand-primary) so light/dark switching is automatic.
 */

/* ============================================================
   Container — applied via <article class="cms-content">
   ============================================================ */
.cms-content {
    color: rgb(var(--foreground));
    font-size: 1rem;
    line-height: 1.75;
    word-wrap: break-word;
}

/* Page title (rendered outside .cms-content as <h1>) */
.cms-page-title {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    line-height: 1.2;
    color: rgb(var(--foreground));
    margin: 0 0 1.5rem;
    letter-spacing: -0.02em;
}

/* ============================================================
   Headings — auto-sized for h1 → h6
   ============================================================ */
.cms-content h1,
.cms-content h2,
.cms-content h3,
.cms-content h4,
.cms-content h5,
.cms-content h6 {
    color: rgb(var(--foreground));
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    scroll-margin-top: 5rem;          /* nice anchor jumps under sticky header */
}

.cms-content h1 {
    font-size: clamp(1.625rem, 3.5vw, 2rem);
    margin: 2.25rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgb(var(--card-border));
}

.cms-content h2 {
    font-size: clamp(1.375rem, 2.6vw, 1.625rem);
    margin: 2rem 0 0.875rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid rgb(var(--card-border) / 0.6);
}

.cms-content h3 {
    font-size: clamp(1.125rem, 2vw, 1.25rem);
    margin: 1.75rem 0 0.625rem;
}

.cms-content h4 {
    font-size: 1.0625rem;
    margin: 1.25rem 0 0.5rem;
    font-weight: 600;
}

.cms-content h5,
.cms-content h6 {
    font-size: 0.9375rem;
    margin: 1rem 0 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgb(var(--muted-fg));
}

/* First heading should not have huge top margin */
.cms-content > h1:first-child,
.cms-content > h2:first-child,
.cms-content > h3:first-child {
    margin-top: 0;
}

/* ============================================================
   Body text
   ============================================================ */
.cms-content p {
    margin: 0 0 1rem;
}

.cms-content strong { font-weight: 600; color: rgb(var(--foreground)); }
.cms-content em     { font-style: italic; }
.cms-content small  { font-size: 0.875em; color: rgb(var(--muted-fg)); }

.cms-content hr {
    border: 0;
    border-top: 1px solid rgb(var(--card-border));
    margin: 2rem 0;
}

/* ============================================================
   Links
   ============================================================ */
.cms-content a {
    color: rgb(var(--brand-primary));
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgb(var(--brand-primary) / 0.35);
    transition: border-color 0.15s ease, color 0.15s ease;
}
.cms-content a:hover {
    border-bottom-color: rgb(var(--brand-primary));
}
.cms-content a:focus-visible {
    outline: 2px solid rgb(var(--brand-primary) / 0.5);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================================
   Lists
   ============================================================ */
.cms-content ul,
.cms-content ol {
    margin: 0 0 1.25rem;
    padding-inline-start: 1.5rem;
}
.cms-content ul { list-style: disc; }
.cms-content ol { list-style: decimal; }
.cms-content li {
    margin-bottom: 0.5rem;
    padding-inline-start: 0.25rem;
}
.cms-content li::marker { color: rgb(var(--muted-fg)); }
.cms-content li > ul,
.cms-content li > ol { margin: 0.5rem 0; }

/* ============================================================
   Quotes & code
   ============================================================ */
.cms-content blockquote {
    margin: 1.5rem 0;
    padding: 0.75rem 1.25rem;
    border-inline-start: 4px solid rgb(var(--brand-primary) / 0.5);
    background: rgb(var(--card-border) / 0.25);
    border-radius: 5px;
    color: rgb(var(--muted-fg));
    font-style: italic;
}
.cms-content blockquote p:last-child { margin-bottom: 0; }

.cms-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875em;
    background: rgb(var(--card-border) / 0.45);
    padding: 0.125em 0.375em;
    border-radius: 4px;
    color: rgb(var(--foreground));
}
.cms-content pre {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: rgb(var(--card-border) / 0.35);
    border: 1px solid rgb(var(--card-border));
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}
.cms-content pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/* ============================================================
   Tables — responsive scroll on small screens
   ============================================================ */
.cms-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9375rem;
    border: 1px solid rgb(var(--card-border));
    border-radius: 8px;
    overflow: hidden;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}
@media (min-width: 640px) {
    .cms-content table { display: table; white-space: normal; }
}
.cms-content thead {
    background: rgb(var(--card-border) / 0.45);
}
.cms-content th,
.cms-content td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid rgb(var(--card-border) / 0.6);
    text-align: start;
    vertical-align: top;
}
.cms-content th { font-weight: 600; color: rgb(var(--foreground)); }
.cms-content tbody tr:last-child td { border-bottom: 0; }
.cms-content tbody tr:nth-child(even) {
    background: rgb(var(--card-border) / 0.15);
}

/* ============================================================
   Images & figures
   ============================================================ */
.cms-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.25rem 0;
    border: 1px solid rgb(var(--card-border));
}
.cms-content figure { margin: 1.5rem 0; }
.cms-content figcaption {
    font-size: 0.875rem;
    color: rgb(var(--muted-fg));
    text-align: center;
    margin-top: 0.5rem;
}

/* ============================================================
   .cms-meta — auto-applied to the first paragraph that contains
   "Effective Date / Last Updated / Published / Version".
   Renders as a small, rounded, theme-aware info box.
   ============================================================ */
.cms-content .cms-meta {
    display: block;
    margin: 0 0 1.75rem;
    padding: 0.625rem 1rem;
    border-radius: 5px;
    border: 1px solid rgb(var(--card-border));
    border-inline-start: 4px solid rgb(var(--brand-primary));
    background: rgb(var(--card-border) / 0.2);
    color: rgb(var(--muted-fg));
    font-size: 0.8125rem;            /* slightly smaller than body text */
    line-height: 1.55;
    letter-spacing: 0.01em;
}
.cms-content .cms-meta strong {
    color: rgb(var(--foreground));
    font-weight: 600;
}

/* ============================================================
   Responsive tweaks
   ============================================================ */
@media (max-width: 640px) {
    .cms-content                  { font-size: 0.9375rem; line-height: 1.7; }
    .cms-content h1               { margin-top: 1.75rem; }
    .cms-content h2               { margin-top: 1.5rem; }
    .cms-content ul,
    .cms-content ol               { padding-inline-start: 1.25rem; }
    .cms-content blockquote       { padding: 0.625rem 1rem; }
    .cms-content pre              { padding: 0.75rem 1rem; font-size: 0.8125rem; }
}