/* ==========================================================
   Royal Crown Engineering Ltd - legal pages + 404
   Matches the look of the existing pages (same colours, same
   navigation) so the new pages feel like part of the same site.
   ========================================================== */
:root {
    --primary-color: #1a4d80;
    --secondary-color: #3a7ca5;
    --accent-color: #63a2c6;
    --light-color: #d6eaf8;
    --dark-color: #0c2d4a;
    --text-color: #333;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: Arial, Helvetica, sans-serif; }
html { scroll-behavior: smooth; }
body { background: #f8f9fa; color: var(--text-color); line-height: 1.6; overflow-x: hidden; }
a { color: var(--primary-color); }

/* Navigation (same markup and look as the other pages) */
body > nav {
    background: var(--dark-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.nav-container { width: 80%; margin: 0 auto; display: flex; justify-content: space-around; }
.nav-item {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}
.nav-item:hover { background: var(--accent-color); }
.mobile-nav { display: none; }

/* Page title band */
.page-hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    text-align: center;
    padding: 3.5rem 1.25rem 3rem;
}
.page-hero h1 { font-size: 2.3rem; margin-bottom: 0.6rem; }
.page-hero p { max-width: 62ch; margin: 0 auto; color: #e8f3fb; }
.page-hero .updated { margin-top: 0.9rem; font-size: 0.9rem; color: var(--light-color); }

/* Document layout: contents on the left, text on the right */
.legal-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 3rem;
    width: min(1100px, 92%);
    margin: 3rem auto 4rem;
    align-items: start;
}
.toc {
    position: sticky;
    top: 5.5rem;
    background: #fff;
    border: 1px solid #dbe7f0;
    border-radius: 8px;
    padding: 1rem 1.1rem;
}
.toc summary { cursor: pointer; font-weight: bold; color: var(--primary-color); }
.toc ol { margin: 0.8rem 0 0 1.2rem; font-size: 0.93rem; }
.toc li { margin: 0.4rem 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.legal-body { max-width: 72ch; }
.legal-body section { margin-bottom: 2.4rem; scroll-margin-top: 5.5rem; }
.legal-body h2 { font-size: 1.4rem; color: var(--primary-color); margin-bottom: 0.8rem; }
.legal-body h3 { font-size: 1.05rem; color: var(--dark-color); margin: 1.2rem 0 0.4rem; }
.legal-body p { margin-bottom: 0.9rem; line-height: 1.75; }
.legal-body ul, .legal-body ol { margin: 0 0 1rem 1.4rem; line-height: 1.75; }
.legal-body li { margin-bottom: 0.35rem; }
.legal-body .lead { font-size: 1.08rem; }

.table-wrap { overflow-x: auto; margin: 0.5rem 0 1.2rem; border: 1px solid #dbe7f0; border-radius: 8px; background: #fff; }
.table-wrap table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 0.93rem; }
.table-wrap th, .table-wrap td { text-align: left; vertical-align: top; padding: 0.75rem 0.9rem; border-bottom: 1px solid #e6eef5; }
.table-wrap th { background: var(--light-color); color: var(--dark-color); }
.table-wrap tr:last-child td { border-bottom: 0; }

.contact-card {
    background: #fff;
    border: 1px solid #dbe7f0;
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 1rem 1.2rem;
    line-height: 1.8;
    font-style: normal;
}

.related { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid #dbe7f0; }
.related h2 { font-size: 1.1rem; margin-bottom: 0.8rem; color: var(--dark-color); }
.related ul { list-style: none; margin: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.related a {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #c5d9e8;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.92rem;
}
.related a:hover { background: var(--light-color); }

/* Sitemap page */
.sitemap-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.sitemap-groups .group { background: #fff; border: 1px solid #dbe7f0; border-radius: 8px; padding: 1.2rem 1.3rem; }
.sitemap-groups h2 { font-size: 1.1rem; margin-bottom: 0.7rem; }
.sitemap-groups ul { list-style: none; margin: 0; }
.sitemap-groups li { margin: 0.45rem 0; }
.sitemap-wide { width: min(1100px, 92%); margin: 3rem auto 4rem; }

/* 404 page */
.error-page { width: min(760px, 92%); margin: 4rem auto 5rem; text-align: center; }
.error-code { display: flex; align-items: center; justify-content: center; gap: 0.2rem; color: var(--primary-color); font-weight: bold; font-size: clamp(4.5rem, 16vw, 8rem); line-height: 1; }
.error-code svg { width: 0.9em; height: 0.9em; }
.error-page h1 { font-size: 1.8rem; color: var(--dark-color); margin: 1.2rem 0 0.6rem; }
.error-page > p { max-width: 52ch; margin: 0 auto 1.8rem; }
.btn-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; margin-bottom: 2.5rem; }
.btn {
    display: inline-block;
    padding: 0.8rem 1.6rem;
    border-radius: 4px;
    font-weight: bold;
    text-decoration: none;
    background: var(--primary-color);
    color: #fff;
    border: 2px solid var(--primary-color);
    transition: background-color 0.2s ease;
}
.btn:hover { background: var(--secondary-color); border-color: var(--secondary-color); }
.btn.secondary { background: transparent; color: var(--primary-color); }
.btn.secondary:hover { background: var(--light-color); }
.error-links h2 { font-size: 1rem; margin-bottom: 0.8rem; color: var(--dark-color); }
.error-links ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.error-links a { display: inline-block; padding: 0.45rem 1rem; background: #fff; border: 1px solid #c5d9e8; border-radius: 999px; text-decoration: none; font-size: 0.92rem; }
.error-links a:hover { background: var(--light-color); }

a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent-color); outline-offset: 2px; }

@media (max-width: 900px) {
    .legal-layout { grid-template-columns: 1fr; gap: 1.5rem; margin-top: 2rem; }
    .toc { position: static; }
}
@media (max-width: 768px) {
    .nav-container { width: 90%; }
    .desktop-nav { display: none; }
    .mobile-nav { display: block; width: 100%; }
    .hamburger-icon { display: flex; flex-direction: column; justify-content: space-between; width: 30px; height: 21px; cursor: pointer; margin: 0 auto; position: relative; z-index: 1001; }
    .hamburger-icon span { display: block; height: 3px; width: 100%; background: #fff; border-radius: 3px; transition: all 0.3s ease; }
    .hamburger-icon.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .hamburger-icon.active span:nth-child(2) { opacity: 0; }
    .hamburger-icon.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }
    .mobile-menu {
        position: fixed; top: -100%; left: 0; width: 100%;
        background: var(--dark-color);
        padding: 60px 0 20px;
        display: flex; flex-direction: column; align-items: center;
        transition: top 0.3s ease; z-index: 1000;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    .mobile-menu.active { top: 0; }
    .mobile-menu .nav-item { margin: 10px 0; font-size: 1.1rem; width: 80%; text-align: center; }
    .page-hero h1 { font-size: 1.8rem; }
}
@media print {
    nav, .toc, .related { display: none; }
    body { background: #fff; }
    .page-hero { background: none; color: #000; padding: 1rem 0; }
    .page-hero p, .page-hero .updated { color: #333; }
    .legal-layout { display: block; margin: 1rem auto; }
}