:root {
    --ink: #132630;
    --ink-soft: #3f515a;
    --blueprint: #2f6586;
    --blueprint-dark: #173f59;
    --sky-wash: #e8f0f3;
    --paper: #f7f8f5;
    --white: #ffffff;
    --signal: #b84327;
    --line: #bfccd0;
    --display: "Source Serif 4", Georgia, serif;
    --body: "DM Sans", Arial, sans-serif;
    --utility: "IBM Plex Mono", "Courier New", monospace;
    --shadow: 0 24px 70px rgba(19, 38, 48, .16);
    --max-width: 1180px;

    /* Temporary aliases for page-specific rules while the legacy stylesheet is retired. */
    --pure-white: var(--white);
    --background-gray: var(--paper);
    --surface-gray: var(--line);
    --medium-gray: var(--ink-soft);
    --medium-text: var(--ink-soft);
    --text-gray: var(--ink-soft);
    --charcoal: var(--ink);
    --primary-color: var(--blueprint);
    --gradient-hero: linear-gradient(135deg, var(--sky-wash), var(--paper));
    --gradient-section: linear-gradient(135deg, var(--paper), var(--sky-wash));
    --border-radius: 4px;
    --border-radius-large: 6px;
    --shadow-card: 0 12px 32px rgba(19, 38, 48, .1);
    --shadow-button: none;
    --transition: all .2s ease;
}

body.theme-page,
body.account-action-page {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.theme-page *,
.theme-page *::before,
.theme-page *::after,
.account-action-page *,
.account-action-page *::before,
.account-action-page *::after { box-sizing: border-box; }

.theme-page img { display: block; max-width: 100%; }
.theme-page button,
.theme-page input { font: inherit; }
.theme-page .container { width: min(100%, 1200px); margin-inline: auto; padding-inline: 20px; }

body.theme-page.menu-open { overflow: hidden; }
body.theme-page { overflow-x: clip; }

body.theme-page a,
body.account-action-page a { color: var(--blueprint); }

body.theme-page :focus-visible,
body.account-action-page :focus-visible {
    outline: 3px solid var(--signal);
    outline-offset: 4px;
}

.theme-page .skip-link {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 2000;
    padding: .7rem 1rem;
    border-radius: 4px;
    background: var(--ink);
    color: var(--white);
    transform: translateY(-180%);
    transition: transform .2s ease;
}

.theme-page .skip-link:focus { transform: translateY(0); }

/* Shared navigation for pages that still use the original shell markup. */
.theme-page .nav {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1000;
    width: 100%;
    border-bottom: 1px solid rgba(19, 38, 48, .12);
    background: rgba(247, 248, 245, .92);
    backdrop-filter: blur(18px);
}

.theme-page .nav-container {
    width: min(calc(100% - 40px), var(--max-width));
    max-width: none;
    min-height: 72px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-inline: auto;
    padding: 0;
}

.theme-page .nav-logo,
.theme-page .nav-logo > a {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: var(--ink) !important;
    font-family: var(--display);
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.theme-page .nav-logo .logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.theme-page .nav-menu {
    position: static;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    flex-direction: row;
    justify-content: flex-start;
    gap: clamp(1rem, 2.3vw, 2rem);
    padding: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
}

.theme-page .nav-link {
    padding: 0;
    color: var(--ink-soft);
    font-family: var(--body);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
}

.theme-page .nav-link::after { display: none; }
.theme-page .nav-link:hover,
.theme-page .nav-link:focus-visible { color: var(--blueprint); }

.theme-page .nav-link.nav-cta {
    padding: .7rem 1rem;
    border: 1px solid var(--ink);
    border-radius: 3px;
    background: var(--ink);
    color: var(--white);
}

.theme-page .nav-toggle {
    width: 48px;
    height: 48px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
}

.theme-page .nav-toggle span {
    width: 24px;
    height: 2px;
    margin: 0;
    background: var(--ink);
    transition: transform .2s ease, opacity .2s ease;
}

.theme-page .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.theme-page .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.theme-page .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Shared legacy-markup footer, visually matched to the main page. */
.theme-page .footer {
    padding: 72px 0 24px;
    background: var(--ink);
    color: var(--white);
}

.theme-page .footer > .container {
    width: min(calc(100% - 40px), var(--max-width));
    max-width: none;
    margin-inline: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.theme-page .footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    margin: 0;
    padding-bottom: 4rem;
}

.theme-page .footer-logo {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    margin: 0;
    color: var(--white);
    font-family: var(--display);
    font-size: 1.2rem;
    font-weight: 700;
}

.theme-page .footer-logo .logo-icon { width: 32px; height: 32px; }
.theme-page .footer-description { max-width: 330px; margin: 1rem 0 0; color: #aebdc4; }

.theme-page .footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.theme-page .link-group h4 {
    margin: 0 0 .8rem;
    color: #a9bbc3;
    font-family: var(--utility);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.theme-page .link-group a {
    display: block;
    margin: 0 0 .45rem;
    color: #d7e0e3;
    font-size: .9rem;
    text-decoration: none;
}

.theme-page .link-group a:hover {
    color: var(--white);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.theme-page .footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.25rem;
    border-top: 1px solid #4b6069;
    color: #b6c4ca;
    font-family: var(--utility);
    font-size: .75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.theme-page .footer-bottom p { margin: 0; }

/* Contact and account-deletion tasks. */
.theme-page .contact-hero,
.theme-page .deletion-hero {
    padding: 150px 0 76px;
    background:
        linear-gradient(rgba(47, 101, 134, .09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(47, 101, 134, .09) 1px, transparent 1px),
        var(--sky-wash);
    background-size: 36px 36px;
}

.theme-page .contact-header,
.theme-page .deletion-header {
    margin: 0;
    text-align: left;
}

.theme-page .contact-header::before,
.theme-page .deletion-header::before,
.legal-page .legal-document::before {
    display: inline-block;
    margin-bottom: 1rem;
    padding: .32rem .48rem;
    background: var(--blueprint-dark);
    color: var(--white);
    font-family: var(--utility);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.theme-page .contact-header::before { content: "SUPPORT · BUILDING LORE"; }
.theme-page .deletion-header::before { content: "ACCOUNT · DATA CONTROL"; }
.legal-page.privacy-page .legal-document::before { content: "LEGAL · PRIVACY"; }
.legal-page.terms-page .legal-document::before { content: "LEGAL · TERMS"; }

.theme-page .contact-header h1,
.theme-page .deletion-header h1 {
    margin: 0 0 1rem;
    color: var(--ink);
    font-family: var(--display);
    font-size: clamp(3.2rem, 7vw, 5.5rem);
    font-weight: 600;
    letter-spacing: -.04em;
    line-height: 1;
}

.theme-page .contact-header p,
.theme-page .deletion-header p {
    max-width: 680px;
    margin: 0;
    color: var(--ink-soft);
    font-size: 1.15rem;
}

.theme-page .contact-content,
.theme-page .deletion-content {
    padding: 72px 0 100px;
    background: var(--white);
}

.theme-page .contact-content .container,
.theme-page .deletion-content .container { max-width: 800px; }

.theme-page .content-section h2,
.theme-page .contact-box h2 {
    color: var(--ink);
    font-family: var(--display);
    font-size: 1.75rem;
    line-height: 1.15;
}

.theme-page .content-section h3,
.theme-page .topic-card h3 {
    color: var(--ink);
    font-family: var(--display);
}

.theme-page .content-section p,
.theme-page .content-section li,
.theme-page .contact-box p,
.theme-page .topic-card p { color: var(--ink-soft); }

.theme-page .contact-box,
.theme-page .topic-card,
.theme-page .response-notice,
.theme-page .timeline-box,
.theme-page .important-notice {
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--paper);
    box-shadow: none;
}

.theme-page .email-button {
    max-width: 100%;
    padding: .9rem 1rem;
    border: 1px solid var(--ink);
    border-radius: 3px;
    background: var(--ink);
    color: var(--white);
    font-size: .95rem;
    overflow-wrap: anywhere;
    box-shadow: none;
}

.theme-page .email-button:hover { background: var(--blueprint); }

.theme-page .deletion-step-number {
    border: 1px solid var(--blueprint);
    border-radius: 2px;
    background: var(--sky-wash);
    color: var(--blueprint-dark);
    font-family: var(--utility);
}

.theme-page .data-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

/* Long-form legal reading. */
body.theme-page.legal-page {
    padding: 0;
    background: var(--paper);
}

.legal-page .legal-main {
    width: min(calc(100% - 40px), 820px);
    margin: 0 auto;
    padding: 136px 0 100px;
}

.legal-page .legal-document {
    padding: clamp(1.5rem, 5vw, 3.5rem);
    border: 1px solid var(--line);
    border-top: 5px solid var(--signal);
    border-radius: 0;
    background: var(--white);
    box-shadow: none;
}

.legal-page .legal-document h1 {
    margin: 0;
    padding: 0 0 1rem;
    border: 0;
    color: var(--ink);
    font-family: var(--display);
    font-size: clamp(3rem, 7vw, 5rem);
    font-weight: 600;
    letter-spacing: -.04em;
    line-height: 1;
}

.legal-page .last-updated {
    margin: 0 0 2.5rem;
    color: var(--blueprint-dark);
    font-family: var(--utility);
    font-size: .78rem;
    font-style: normal;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.legal-page .legal-document h2 {
    margin: 3.4rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-family: var(--display);
    font-size: 2rem;
    line-height: 1.15;
}

.legal-page .legal-document h3 {
    margin: 2rem 0 .55rem;
    color: var(--ink);
    font-family: var(--display);
    font-size: 1.3rem;
}

.legal-page .legal-document p,
.legal-page .legal-document li {
    color: var(--ink-soft);
    font-size: 1rem;
    line-height: 1.75;
    text-align: left;
}

.legal-page .legal-document a { color: var(--blueprint); }
.legal-page .legal-document strong { color: var(--ink); }

.legal-page .highlight,
.legal-page .toc,
.legal-page .contact-box,
.legal-page .info-box,
.legal-page .important-box {
    border: 1px solid var(--line);
    border-left: 5px solid var(--blueprint);
    border-radius: 0;
    background: var(--sky-wash);
    color: var(--ink);
}

.legal-page .important-box { border-left-color: var(--signal); }

.legal-page .toc h3 {
    font-family: var(--utility);
    font-size: .78rem;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.legal-page .data-table,
.legal-page .pricing-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-color: var(--line);
}

.legal-page .data-table th,
.legal-page .pricing-table th {
    background: var(--blueprint-dark);
    color: var(--white);
}

.legal-page .data-table td,
.legal-page .pricing-table td { border-color: var(--line); }

/* The password flow remains intentionally focused, but now belongs to the brand. */
body.account-action-page {
    background:
        linear-gradient(rgba(47, 101, 134, .08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(47, 101, 134, .08) 1px, transparent 1px),
        var(--sky-wash);
    background-size: 36px 36px;
}

.account-action-page .container {
    border: 1px solid var(--line);
    border-top: 5px solid var(--signal);
    border-radius: 6px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.account-action-page .logo-icon {
    border-radius: 4px;
}

.account-action-page .logo-text,
.account-action-page h1 {
    color: var(--ink);
    font-family: var(--display);
}

.account-action-page .subtitle,
.account-action-page .form-group label,
.account-action-page .requirements { color: var(--ink-soft); }

.account-action-page input {
    border-color: var(--line);
    border-radius: 4px;
    color: var(--ink);
    font-family: var(--body);
}

.account-action-page input:focus {
    border-color: var(--blueprint);
    box-shadow: 0 0 0 3px rgba(47, 101, 134, .16);
}

.account-action-page button[type="submit"] {
    border-radius: 3px;
    background: var(--ink);
    color: var(--white);
}

.account-action-page button[type="submit"]:hover { background: var(--blueprint); }
.account-action-page .back-link { color: var(--blueprint); }

@media (max-width: 900px) {
    .theme-page .nav-toggle { display: flex; }

    .theme-page .nav-menu {
        position: fixed;
        inset: 72px 0 auto;
        width: 100%;
        min-height: calc(100dvh - 72px);
        display: flex;
        align-items: stretch;
        flex-direction: column;
        gap: 0;
        padding: 1rem 20px 2rem;
        border-top: 1px solid var(--line);
        background: var(--paper);
        box-shadow: none;
        transform: translateX(100%);
        visibility: hidden;
        transition: transform .25s ease, visibility .25s ease;
    }

    .theme-page .nav-menu.is-open {
        transform: translateX(0);
        visibility: visible;
    }

    .theme-page .nav-menu .nav-link {
        display: block;
        padding: 1.1rem 0;
        border-bottom: 1px solid var(--line);
        font-family: var(--display);
        font-size: 1.55rem;
    }

    .theme-page .footer-content { grid-template-columns: 1fr; gap: 2.5rem; }
}

@media (max-width: 680px) {
    .theme-page .nav-container,
    .theme-page .footer > .container { width: min(calc(100% - 32px), var(--max-width)); }
    .theme-page .contact-hero,
    .theme-page .deletion-hero { padding: 120px 0 60px; }
    .theme-page .contact-header h1,
    .theme-page .deletion-header h1 { font-size: 3.15rem; line-height: 1.05; }
    .theme-page .footer-links { grid-template-columns: 1fr 1fr; }
    .theme-page .footer-bottom { align-items: flex-start; flex-direction: column; gap: .6rem; }
    .legal-page .legal-main { width: min(calc(100% - 24px), 820px); padding: 108px 0 64px; }
}

@media (prefers-reduced-motion: reduce) {
    .theme-page *,
    .theme-page *::before,
    .theme-page *::after,
    .account-action-page *,
    .account-action-page *::before,
    .account-action-page *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
