/* this is for publishing a website, based on website-style.css. Originally from books repo */

/* Global variables. */
:root,
::backdrop {
    /* Set sans-serif & mono fonts */
    --sans-font: -apple-system, BlinkMacSystemFont, "Avenir Next", Avenir,
        "Nimbus Sans L", Roboto, "Noto Sans", "Segoe UI", Arial, Helvetica,
        "Helvetica Neue", sans-serif;
    --mono-font: Consolas, Menlo, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
    --standard-border-radius: 5px;

    /* Default (light) theme */
    --bg: red;
    --accent-bg: #f5f7ff;
    --text: #212121;
    --text-light: #585858;
    --border: green;
    --accent: #0d47a1;
    --accent-hover: #1266e2;
    --accent-text: var(--bg);
    --code: #d81b60;
    --preformatted: #444;
    --marked: #ffdd33;
    --disabled: #efefef;

    /* my variables */
    --max-width: 100ch;
}


* {
    box-sizing: border-box;
}

p {
    white-space: pre-line;
    
}

html {
    /* Set the font globally */
    font-family: var(--sans-font);
    scroll-behavior: smooth;
}

body {
    /*color: var(--text);*/
    background-color: var(--bg);
    background-color: silver;

    font-size: 1.1em;
    /*line-height: 1.5;*/
    /*margin: 1em;*/
    /*margin-left: 1em;*/
    /*padding-left: 0em;*/
    font-family: Arial, Helvetica, sans-serif;
    border: 1px solid red;
    border-radius: var(--standard-border-radius);
    counter-reset: chapter;


    margin: 0;
    /* Remove default body margin */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center horizontally */
    align-items: center;
    /* Center vertically */
    /* height: 100%; */
    /* Full viewport height */
    width: 100%; 
    /* Full viewport height */
}

header, main, footer {
    max-width: var(--max-width);
    /*min-width: var(--max-width);*/
    padding-top: .5em;
    padding-right: 1em;
    padding-bottom: 0em;
    padding-left: 1em;
    background-color: #fff;
    border: 1px solid #ccc;
    overflow-wrap: break-word;
    word-break: break-word;
    /*white-space: normal;*/
    hyphens: auto;
}

header *, main *, footer * {
    overflow-wrap: inherit;
    word-break: inherit;
    /*white-space: inherit;*/
    hyphens: inherit;
}

p {
    /*max-width: 50ch;*/
    /* Limit width to 50 characters */
    white-space: normal;
    /* Ensure text wraps */
    overflow-wrap: break-word;
    /* Break long words if necessary */
    /* max-width: 50ch; */

}

body>header {
    background-color: var(--accent-bg);
    /*border-bottom: 112px solid var(--border);*/
    text-align: center;
    /*grid-column: 2 / 3;*/
    border: 1px solid var(--border);
    border-radius: var(--standard-border-radius);
    display: flex;
    flex-direction: column;
    padding-bottom: 1em;
}

body>header>h1 {
    margin-top: 0.0em;
    font-size: 1.5rem;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--standard-border-radius);
    background-color: pink;
}

body>header>h1>a {
    text-decoration: none;
    color: black;
}

body>header>nav>a {
    text-decoration: none;
}

header>nav a,
header>nav a:visited {
    text-decoration: none;
    /*padding: 0.1em 1em;*/
    padding: 0.5em 0.5em 0.5em 0.5em;
    border: 1px solid var(--border);
    border-radius: var(--standard-border-radius);
    /*color: var(--text);*/
    margin-top: 0.0em;
    margin-right: 0.5em;
    margin-bottom: 0.0em;
    margin-left: 0.5em;

}

.nav_bar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    /*background: powderblue;*/

}

/* Mobile Responsive layout - makes a one column-layout instead of two-column layout */

@media only screen and (max-width: 720px) {
    .nav_bar {
        flex-direction: column;
        /*flex-direction: row;*/
    }
}



body>main {
    margin-top: 1em;
    border: 1px solid var(--border);
    border-radius: var(--standard-border-radius);
    background-color: var(--accent-bg);

}

body>footer {
    margin-top: 1em;
    color: var(--text-light);
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--standard-border-radius);
    background-color: var(--accent-bg);
}

/*table, I do not know much*/
/* Format tables */
table {
    border-collapse: collapse;
    margin: 1.5rem 0;
}

figure>table {
    width: max-content;
    margin: 0;
}

td,
th {
    border: 1px solid var(--border);
    text-align: start;
    padding: 0.5rem;
}

th {
    background-color: var(--accent-bg);
    font-weight: bold;
}

tr:nth-child(even) {
    /* Set every other cell slightly darker. Improves readability. */
    background-color: var(--accent-bg);
}

table caption {
    font-weight: bold;
    margin-bottom: 0.5rem;
}


/* counters to h1 h2 h3 */

header h1::before {
    content: "";
    counter-reset: h1;
    font-size: 1rem;
}


body {
    counter-reset: h1;
    /* Reset counter for h1 */
}

h1 {
    counter-reset: h2;
    /* Reset counter for h2 when h1 appears */
}

h2 {
    counter-reset: h3;
    /* Reset counter for h3 when h2 appears */
}

h1:before {
    content: counter(h1) ".";
    /* Add h1 number */
    counter-increment: h1;
    /* Increment h1 counter */
}

h2:before {
    content: counter(h1) "." counter(h2) ". ";
    /* Add h2 number */
    counter-increment: h2;
    /* Increment h2 counter */
}

h3:before {
    content: counter(h1) "." counter(h2) "." counter(h3) ". ";
    /* Add h3 number */
    counter-increment: h3;
    /* Increment h3 counter */
}
