* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --max-content-width: 900px;
    --base-padding-desktop: 24px;
    --base-padding-mobile: 16px;
    --line-height-base: 1.5;
    --body-font-family:
        system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

html {
    font-size: clamp(15px, 1.6vw, 18px);
}

.container {
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding-left: min(4vw, 32px);
    padding-right: min(4vw, 32px);
}

/* Make headings responsive and readable */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    line-height: 1.15;
    font-weight: 600;
}

h1 {
    font-size: clamp(1.4rem, 6vw, 2.4rem);
}
h2 {
    font-size: clamp(1.2rem, 4.5vw, 1.8rem);
}
h3 {
    font-size: clamp(1.05rem, 3.6vw, 1.2rem);
}

img,
picture,
svg,
iframe,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

a,
button {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
}
a {
    color: inherit;
    text-decoration-skip-ink: auto;
}
button,
.btn {
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border-radius: 6px;
}

p {
    margin-top: 0;
    margin-bottom: 1rem;
}

* {
    word-wrap: break-word;
}

@media (max-width: 480px) {
    body {
        padding: var(--base-padding-mobile);
    }

    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    h1 {
        font-size: clamp(1.2rem, 7vw, 1.9rem);
    }
}
:focus {
    outline: 2px solid Highlight;
    outline-color: #777;
    outline-offset: 2px;
}

*::-webkit-scrollbar {
    display: none;
}

* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body {
    font-family:
        New Century Schoolbook,
        TeX Gyre Schola,
        serif;
    font-size: 1rem;
    line-height: 1.5;
    color: #ffffff;
    background-color: #000000;
    margin: 0;
    padding: clamp(12px, 4vw, var(--base-padding-desktop));
    user-select: none;
}

::selection {
    background-color: #aaaaaa;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

p {
    margin-bottom: 1rem;
}

a {
    color: #ffffff;
    text-decoration: underline;
    cursor: pointer;
}

a:hover {
    text-decoration: none;
    color: #000000;
    background-color: #ffffff;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header,
footer,
main,
section,
article {
    display: block;
    margin-bottom: 2rem;
}

button,
input[type="submit"],
input[type="button"] {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #000000;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    margin: 0.5rem 0;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    background-color: #ffffff;
    color: #000000;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 2px solid #000000;
    background-color: #ffffff;
    color: #000000;
    font-size: 1rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;
    border-color: #000000;
    background-color: #f8f8f8;
}

ul,
ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.25rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

th,
td {
    padding: 0.75rem;
    border: 1px solid #000000;
    text-align: left;
}

th {
    background-color: #000000;
    color: #ffffff;
    font-weight: 700;
}

.text-center {
    text-align: center;
}

.mt-0 {
    margin-top: 0;
}
.mb-0 {
    margin-bottom: 0;
}
.mt-1 {
    margin-top: 1rem;
}
.mb-1 {
    margin-bottom: 1rem;
}
.mt-2 {
    margin-top: 2rem;
}
.mb-2 {
    margin-bottom: 2rem;
}

hr {
    border: 0;
    height: 1px;
    background-color: #ffffff;
    margin: 2rem 0;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

code,
pre {
    font-family: "Courier New", monospace;
    background-color: #f8f8f8;
    color: #000000;
    padding: 0.25rem 0.5rem;
}

pre {
    padding: 1rem;
    overflow-x: auto;
    white-space: pre;
}

footer {
    border-top: 2px solid #000000;
    padding-top: 1rem;
    font-size: 0.9rem;
}

.header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header img {
    width: 50px;
    height: 50px;
}

hr.space-top {
    margin-top: 6em;
}
hr.space-bottom {
    margin-bottom: 6em;
}

.question-hr {
    margin: 50px;
    opacity: 10%;
}

.textual-hr {
    border: none;
    background-color: #000000;
    height: 1.5em;
    line-height: 1em;
    position: relative;
    margin: 20px 0;
}

.textual-hr::before {
    content: "";
    background: linear-gradient(to right, #fff, #000 70%);
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    z-index: 1;
}

.textual-hr::after {
    content: attr(data-content);

    background-color: #000000;
    color: #fff;
    padding: 0 10px;
    position: relative;
    z-index: 2;
}

* {
    border-radius: 0 !important;
}

* {
    background-image: none !important;
}

/* MISC */

/* torusKnot (p1q3) */

.torus-embed {
    width: 100%;
    height: 360px;
    max-height: 70vh;
    position: relative;
    overflow: hidden;
    background: #000;
}

#torus-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: grab;
}
#torus-canvas:active {
    cursor: grabbing;
}

/* light mode switch */

.theme-switch {
    /* Style the switch block to sit nicely in the header */
    margin-left: auto; /* Push it to the right */
    font-size: 0.8rem;
    font-weight: 400;
    white-space: nowrap;
    user-select: none;
}

.theme-switch a {
    text-decoration: none; /* Remove underline for a cleaner look */
    padding: 2px 4px;
    transition:
        background-color 0.2s,
        color 0.2s;
}

/* Target the body when it has the .light-mode class */
body.light-mode {
    color: #000000; /* Black text */
    background-color: #ffffff; /* White background */
}

/* Ensure all other themed elements adapt */
body.light-mode h1,
body.light-mode h2,
body.light-mode h3,
body.light-mode h4,
body.light-mode h5,
body.light-mode h6 {
    color: #000000; /* Black headings */
}

body.light-mode hr {
    background-color: #000; /* Black horizontal rule */
}
body.light-mode hr.textual-hr {
    background-color: #fff;
}

body.light-mode a {
    color: #000000; /* Black links */
}

body.light-mode a:hover {
    color: #ffffff;
    background-color: #000000;
}

body.light-mode .textual-hr::before {
    /* Adjust the gradient for the textual divider */
    background: linear-gradient(to right, #000, #fff 70%);
}

body.light-mode .textual-hr::after {
    /* The text background changes to match the body */
    background-color: #ffffff;
    color: #000000;
}

/* Style the active mode link */
.theme-switch a#dark-mode-link {
    font-weight: bold;
}
body.light-mode .theme-switch a#dark-mode-link {
    font-weight: normal;
}
body.light-mode .theme-switch a#light-mode-link {
    font-weight: bold;
}
