/* =========================================
   Legacy Styles (formerly basic.css)
   Preserved for sub-page print layouts
   ========================================= */

body {
    font-family: Arial, sans-serif;
    background-color: #ffffff;
    color: #222;
    margin: 0px;
    line-height: 1.6;
}

h1 {
    text-align: center;
    font-size: 36px;
    margin-bottom: 0px;
}

h2 {
    margin-bottom: 0px;
}

p {
    /*max-width: 700px;*/
    text-align: center;
    margin: 4px auto;
}

a {
    display: block;
    text-align: center;
    margin-top: 4px;
    font-size: 18px;
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.width30 {
    width: 30%;
}

.width50 {
    width: 50%;
}

.width70 {
    width: 70%;
}

.width100 {
    margin-left: 40px;
    width: 100%;
}

.tinynote {
    text-align: center;
    font-size: smaller;
}

.bordered {
    border: 1px solid black;
    margin-left: 10px;
    margin-right: 10px;
}

@media print {
    .no-print {
        display: none !important;
    }
}

.center-underline,
.modern-ui .center-underline {
    text-align: center;
    text-decoration: underline;
}

/* =========================================
   Modern UI Styles (formerly embedded in index.html)
   Scoped to .modern-ui to prevent leakage to legacy pages
   ========================================= */

:root {
    --bg: #fff;
    --ink: #0f172a;
    --muted: #475569;
    --line: #e2e8f0;
    --card: #f8fafc;
    --accent: #0ea5e9;
    --primary-color: #222;
    --accent-color: #0066cc;
    --bg-color: #f9f9f9;
    --card-bg: #ffffff;
    --spacing-unit: 1rem;
    --container-width: 800px;
}

.modern-ui * {
    box-sizing: border-box;
}

/* Scoped global overwrites */
html.modern-ui,
body.modern-ui {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial;
}

.modern-ui a {
    color: inherit;
    text-decoration: none;
    /* Reset basic.css 'block' display if needed, though flex/grid usually handles it. 
       basic.css sets a { display: block; text-align: center; ... }. 
       index.html usage is mostly flex items or block items. 
       We should explicitly reset common properties from basic.css if they interfere. */
    display: inline;
    /* Default reset, though flex items ignore this */
    text-align: left;
    /* Reset */
    margin-top: 0;
    font-size: inherit;
}

.modern-ui a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 8px;
}

.modern-ui h2 {
    font-size: 1.1rem;
    margin: 0 0 .6rem 0;
    color: #0b1324;
    text-align: left;
    /* Reset basic.css inheritance? basic.css doesn't align h2, inherits left usually. */
}

/* Component classes (Safe to utilize globally as subpages don't use them, 
   but keeping grouped for clarity) */

.container {
    max-width: 980px;
    margin: auto;
    padding: 24px;
}

header {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.title {
    font-size: clamp(1.4rem, 3.2vw, 2rem);
    margin: 0;
}

.sub {
    color: var(--muted);
    font-size: .95rem;
    margin: 0;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
}

.grid {
    display: grid;
    gap: 12px;
}

@media(min-width: 720px) {
    .grid {
        grid-template-columns: 1fr 1fr;
    }
}

.list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media(min-width: 560px) {
    .list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media(min-width: 900px) {
    .list {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Increased specificity to override .modern-ui a */
.modern-ui .item {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    /* Ensure no underline */
    color: inherit;
    /* Ensure color */
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: transform .06s ease, box-shadow .06s ease;
}

.item:hover {
    transform: translateY(-1px);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .04), 0 4px 12px rgba(2, 6, 23, .06);
}

/* Override basic.css print styles for modern UI if needed */
@media print {
    .modern-ui .item:hover {
        box-shadow: none;
        transform: none;
    }

    .modern-ui a {
        text-decoration: none;
    }
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #e2e8f0;
    flex-shrink: 0;
    display: inline-block;
}

/* Belt Colors */
.white .dot {
    background: #fff;
}

.orange .dot {
    background: #fb923c;
}

.yellow .dot {
    background: #fde047;
}

.green .dot {
    background: #22c55e;
}

.blue .dot {
    background: #3b82f6;
}

.red .dot {
    background: #ef4444;
}

.black .dot {
    background: #111827;
}

.stripe {
    background: linear-gradient(90deg, transparent 0 45%, #111827 45% 55%, transparent 55% 100%), var(--line);
}

footer {
    margin-top: 18px;
    color: var(--muted);
    font-size: .9rem;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

nav.breadcrumbs {
    font-size: .9rem;
    color: var(--muted);
    margin: .2rem 0 1rem;
}

nav.breadcrumbs a {
    border-bottom: 1px dotted var(--line);
    display: inline;
    /* Reset basic.css */
}

/* =========================================
   New Modern Styles (Merged from 01whiteM.html)
   ========================================= */

/* Use specific identifiers or scope to prevent breaking existing modern-ui if needed. 
   For now, we append these as requested to become standard. */

main {
    width: 100%;
    max-width: var(--container-width);
    background: var(--card-bg);
    padding: 2rem;
    margin: 1rem auto;
    /* Reduced from 2rem */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-sizing: border-box;
}

/* Overwriting h1/h2 from basic.css/modern.css to match 01whiteM design */
h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-top: 0;
    /* Ensure no top margin */
    margin-bottom: 1.5rem;
    /* Slightly reduced */
    color: #333;
}

h2 {
    font-size: 1.5rem;
    margin-top: 1rem;
    /* Reduced from 2rem */
    margin-bottom: 1rem;
    text-align: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}

hr {
    border: 0;
    height: 2px;
    /* Thicker */
    background: #ccc;
    /* Darker */
    margin: 1.5rem 0;
    /* Slightly reduced spacing */
}

/* Intro Section Grid */
.intro-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 600px) {
    .intro-grid {
        grid-template-columns: 1fr 1fr;
    }

    .intro-grid.uneven {
        grid-template-columns: 35% 65%;
    }
}

.creed-text {
    font-size: 1.1rem;
    padding-top: 1.5rem;
    /* Replaces the <br /> for visual spacing */
    /* removed italic */
}

.counting-table {
    width: 100%;
    border-collapse: collapse;
}

.counting-table td {
    padding: 0.1rem 0.5rem;
    /* Reduced from 0.25rem */
}

/* Chon-Ji Section */
.pattern-info {
    text-align: center;
    font-weight: 500;
    margin: 0.5rem 0;
    /* Add explicit reduced margin */
}

/* Lists */
ul {
    padding-left: 20px;
    max-width: 600px;
    margin: 0.5rem auto;
    /* Reduced from 0 auto (default usually has margin) or to ensure tight */
}

li {
    margin-bottom: 0.2rem;
    /* Reduced from 0.5rem */
}

/* Notes */
.note {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
    /* Reduced from 1.5rem */
    display: block;
}

.border-box {
    border: 2px solid #333;
    padding: 0.5rem;
    /* Reduced from 1rem */
    text-align: center;
    font-weight: bold;
    margin: 1rem 0;
    /* Reduced from 2rem */
    border-radius: 4px;
}

/* Footer */
.back-link {
    display: inline-block;
    margin-top: 0.5rem;
    /* Reduced from 1rem */
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

.center-text {
    text-align: center;
    margin: 0.2rem 0;
    /* Force reduced margin */
}

p.center-text {
    margin: 0.2rem 0;
}

.center-text p {
    margin: 0.2rem 0;
}

/* Print Styles with Optimizations */
@media print {
    :root {
        font-size: 95%;
        /* Scales all rem-based sizes (margins, padding, fonts) */
    }

    @page {
        margin: 0;
        /* Removes browser default headers/footers */
    }

    body {
        background: white;
        margin: 0.5in;
        /* Adds back the print margin */
        min-height: auto;
        height: auto;
        overflow: visible;
    }

    main {
        box-shadow: none;
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100%;
    }

    .no-print {
        display: none !important;
    }
}

/* Callout/Info Box for Form Pages */
.callout {
    background: #f8fafc;
    border-left: 3px solid #0ea5e9;
    /* accent */
    padding: .6em .9em;
    border-radius: 8px;
    margin: 1em 0;
    text-align: left;
}

/* Additional Utility Styles for Study Sheets */
.tag {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .1rem .55rem;
    margin: .1rem;
    font-size: .82rem;
    background: #f8fafc;
}

.symbol {
    font-size: 1.4rem;
}

.toc {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: var(--card);
    margin-bottom: 2rem;
}

.toc a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--line);
    margin: 0 0.5rem;
    display: inline;
    /* Override any block display */
}

.lead {
    font-size: 1.05rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
    text-align: center;
}

.foot {
    margin-top: 28px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    color: var(--muted);
    font-size: .9rem;
}

/* General Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
    text-align: left;
}

th {
    background: #f8fafc;
    font-weight: 600;
}

tr:nth-child(even) td {
    background: #fafafa;
}

/* Make sure counting-table doesn't get messed up if needed, 
   but stripes are usually good. */
.counting-table td {
    border-bottom: none;
}