body, html {
    font-family: 'EB Garamond', Georgia, serif;
    line-height: 1.65; /* 1.6 to 1.75 is ideal */
    margin: 0;
    padding: 2rem;
    background-color: #f8f9fa;
    color: #212529;
    transition: background-color 0.3s, color 0.3s;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

@media (max-width: 768px) {
    body, html {
        padding: 0.5rem; 
    }

    .content {
        padding: 0.5rem;
    }
}

@media (min-width: 768px) {
    .content {
    max-width: 100ch;
    margin: 2rem auto;
    background-color: #f8f9fb;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }
    html.dark-mode .content {
        background-color: #2c2e36;
        box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    }
}

/* Text width utility classes */
.content-narrow {
    max-width: 100ch;
}

.content-medium {
    max-width: 120ch;
}

.content-wide {
    max-width: 140ch;
}

/* Dark mode */
html.dark-mode, html.dark-mode body {
    background-color: #2e3038;
    color: #e0e0e0;
}

html.dark-mode h1,
html.dark-mode h2,
html.dark-mode h3,
html.dark-mode h4,
html.dark-mode h5,
html.dark-mode h6,
html.dark-mode summary.summary-heading {
    color: #e9eefc;
}
html.dark-mode li,
html.dark-mode ol,
html.dark-mode ul,
html.dark-mode p {
    color: #e0e0e0;
}
html.dark-mode a {
    color: #99a8ff;
}

html.dark-mode h1 a,
html.dark-mode h2 a,
html.dark-mode h3 a,
html.dark-mode h4 a,
html.dark-mode h5 a,
html.dark-mode h6 a {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
}

html.dark-mode h1 a:hover,
html.dark-mode h2 a:hover,
html.dark-mode h3 a:hover,
html.dark-mode h4 a:hover,
html.dark-mode h5 a:hover,
html.dark-mode h6 a:hover {
    color: inherit;
    text-decoration: none;
}

html.dark-mode .intro {
    background-color: #21242c;
    border-left-color: #ccc;
    color: #e0e0e0;
}

html.dark-mode pre,
html.dark-mode code {
    background-color: #2a2a2a;
    color: #eee;
}

html.dark-mode button {
    background-color: #23272f;
    border-color: #555;
    color: #eee;
}

html.dark-mode button:hover {
    background-color: #404859;
    border-color: #666;
}

html.dark-mode button:active {
    background-color: #555;
}

html.dark-mode details details > summary.summary-heading::after {
    border-color: transparent transparent transparent #888;
}

#toggleDarkMode {
    position: sticky;
    top: 1rem;
    float: right; 
    z-index: 1000;
}

/* section borders */
section + section {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}
html.dark-mode section + section {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

html.dark-mode .mobile-cards {
    background-color: #2e3038; /* dark card background */
    border-color: #444;        /* darker border */
    color: #e0e0e0;            /* light text */
}

html.dark-mode .mobile-cards details {
    background-color: #393c46;
    border-color: #555;
}

html.dark-mode .mobile-cards summary {
    color: #e9eefc;
}

html.dark-mode .mobile-cards summary::-webkit-details-marker {
    color: #888; /* subtle marker color */
}

html.dark-mode .checked-off {
    color: #bbb; 
}

h1, h2 {
    text-align: center;
}

h1, h2, h3, h4, h5, h6 {
    color: #2c3e50;
    margin: 0 0 0.5em 0;
}

h1 a,
h2 a,
h3 a,
h4 a,
h5 a,
h6 a {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
}

h1 a:hover,
h2 a:hover,
h3 a:hover,
h4 a:hover,
h5 a:hover,
h6 a:hover {
    color: inherit;
    text-decoration: none;
}

p, ul, ol {
    margin: 0 0 0.5em 0;
}

h2 + ul,
h2 + ol {
    margin-top: 0;
}

li {
    margin-bottom: 0.25em;
}

li input[type="checkbox"] {
    margin-right: 0.5em;
}

ul {
    list-style: none;
    margin-left: 0;
    padding-left: 1.5em;
}

ol {
    margin-left: 1.5em;
    padding-left: 0;
}

section {
    margin-bottom: 0.25rem;
}

pre, code {
    background-color: #efefef;
    padding: 0.5rem;
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.intro {
    background-color: #eef2f3;
    border-left: 4px solid #2c3e50;
    padding: 1rem;
    margin-bottom: 2rem;
}

summary.summary-heading {
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 0.25em;
    list-style: none;
    position: relative;
    padding-left: 20px;
    color: #2c3e50;
}

/* Remove arrow and padding for top-level summary */
details > summary.summary-heading {
    padding-left: 0;
}

details > summary.summary-heading::after {
    content: none;
}

/* Style for nested summaries (subheaders) */
details details > summary.summary-heading {
    font-size: 1rem;
    font-weight: bold;
    padding-left: 20px;
}

details details > summary.summary-heading::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 4px;
    border-color: transparent transparent transparent #bbb;
    transition: transform 0.3s ease;
}

details[open] details > summary.summary-heading::after {
    transform: translateY(-50%) rotate(90deg);
}

summary::-webkit-details-marker {
    display: none;
}

summary::marker {
    content: '';
}

details details {
    margin-left: 1.5rem;
}

a {
    color: #4d67ff;
    text-decoration: none;
    font-weight: bold;
}

a:hover {
    text-decoration: underline;
    font-weight: bold;
}

button {
    background-color: #e0e0e0;
    border: 1px solid #ccc;
    color: #333;
    font-family: Georgia, serif;
    font-size: 0.95rem;
    padding: 0.4rem 0.8rem;
    margin-right: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

button:hover {
    background-color: #d6d6d6;
    border-color: #aaa;
}

button:active {
    background-color: #cfcfcf;
}

/* Hide checkboxes if toggled off */
.checkboxes-hidden input[type="checkbox"] {
    display: none;
}

/* Checked item style */
.checked-off {
    color: #888;
    text-decoration: line-through;
}

input[type="checkbox"] {
    accent-color: #bccbf6; /* muted blue */
}

.toast {
    position: absolute;
    padding: 6px 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    pointer-events: auto;
}

div.buttons-group button {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem; /* adds small vertical spacing if wrapped */
}

div.buttons-group button:last-child {
    margin-right: 0; /* no right margin on last button */
}

@media (max-width: 950px) {
    ul, ol {
        padding-left: 0.75em; /* 2 spaces instead of 4 */
    }
}

@media (max-width: 950px) {
    details details {
        margin-left: 0.75em; /* reduce from 1.5em */
    }
}

button {
    background-color: #f5f7fa;
    border-color: #cbd5e0;
    color: #2d3748;
}

button:hover {
    background-color: #e2e8f0;
    border-color: #a0aec0;
}

/* fix text leading headers */
.subsection > *:not(summary) {
    padding-left: clamp(20px, 3vw, 40px);
}

.variation-table {
    table-layout: fixed;
    border-collapse: collapse;
    width: 90%;
    margin-top: 10px;            
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .variation-table {
        table-layout: auto;
    }

    .variation-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 1rem;
    }
}

.variation-cell {
    border: 1px solid #808080;
    padding: 10px;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;    
}

/* No indent class for notes */
.no-indent {
  padding-left: 0 !important;
}

/* Desktop: show table, hide cards */
@media (min-width: 769px) {
    .mobile-cards {
        display: none;
    }
}

/* Mobile: hide table, show cards */
@media (max-width: 768px) {
    .variation-table {
        display: none;
    }

    .mobile-cards {
        display: block;
        margin-top: 1rem;
    }

    .mobile-cards details {
        border: 1px solid #ccc;
        border-radius: 6px;
        background: #fff;
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
    }

    .mobile-cards summary {
        cursor: pointer;
        font-weight: bold;
        font-size: 1.1rem;
        color: #2c3e50;
    }

    .mobile-cards summary::-webkit-details-marker {
        display: none;
    }

    .mobile-cards p {
        margin-top: 0.5rem;
        line-height: 1.5;
    }
}

#scrollToTopBtn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: rgba(128, 128, 128, 0.7);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    user-select: none;
}

#scrollToTopBtn.show {
    opacity: 1;
    pointer-events: auto;
}


