:root {
    --pageBackground: #f2f5fd;
    --pageBackgroundDarker: hsl(from var(--pageBackground) calc(h + 4) calc(s - 15) calc(l - 2.5));
    --pageBackgroundLighter: hsl(from var(--pageBackground) calc(h + 1) calc(s - 10) calc(l + 1.5));

    --emphColor: #c50b0b;
    --linkColor: #0047a3;
    --textColor: #000;
    --codeColor: #d33682;
    --noteColor: #6d7281;
    --hboxColor: #20497d;
    --brdrColor: oklch(0.922 0 0);
    --bttnColor: oklch(0.985 0 0);
}

@media screen and (max-width: 480px) {
    body {
        max-width: 95%;
        font-size: 100%;
    }
}

@media screen and (min-width: 480px) {
    body {
        max-width: 85%;
    }
}

@media screen and (min-width: 700px) {
    body .intro {
        flex-direction: row-reverse;
    }

    #github {
        position: fixed;
        bottom: 20px;
        left: 20px;
    }

    #instagram {
        position: fixed;
        bottom: 20px;
        left: 70px;
    }

    #discord {
        position: fixed;
        bottom: 20px;
        left: 120px;
    }

    #mode-toggle {
        position: fixed;
        bottom: 20px;
        right: 20px;
    }
}

@media screen and (max-width: 1000px) {
    .notes content {
        flex-basis: 80%;
        padding-top: 0.5em;
    }
    links {
        margin-top: 0em;
    }
}

@media screen and (min-width: 1000px) {
    body {
        max-width: 740px;
    }
    body header {
        flex-direction: row;
    }
    body .notes {
        flex-direction: row;
    }
    .notes content {
        flex-basis: 75%;
        margin: 0.8em 0em 0.7em 0em;
    }
    links {
        margin-top: 0.55em;
    }
}

body {
    font-family: "URWClassico", sans-serif;
    margin-top: 0.5em;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 2em;
}

newcommand {
    display: none;
}

/* Default color of mathjax text */
mjx-container * {
    color: #000000c2;
}

* a {
    text-decoration: none;
}

* a:hover {
    text-decoration: underline;
}

* a:focus {
    outline: none;
}

h1,
h2,
h3,
h4 {
    font-family: "URWClassico", sans-serif;
    font-weight: lighter;
}

p {
    font-family: "URWClassico", sans-serif;
    font-weight: lighter;
}

ul {
    padding-left: 1em;
}

ol {
    padding-left: 1em;
}

ol li {
    padding-left: 0.5em;
}

ol li ol li {
    list-style-type: lower-alpha;
}

.classplan table {
    text-align: left;
    border-collapse: collapse;
}

.classplan table th,
.classplan table td {
    padding: 0.5em;
    border-top: 0.1em solid;
    border-bottom: 0.1em solid;
}

.notes {
    padding: 0em;
    border-top: dotted 0.05em;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.notes > content > paperHead {
    font-family: "URWClassico", sans-serif;
    cursor: pointer;
    display: block;
}

.notes > content > .title {
    display: block;
    font-weight: 900;
    line-height: initial;
    line-height: 125%;
}

.notes > content > paperHead > em {
    font-weight: lighter;
}

.notes > links {
    padding-bottom: 0.5em;
}

.notes > links > a {
    font-size: 93%;
    box-shadow: inset 0 0 0 0 #959aa8;
    color: var(--noteColor);
    transition: color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.notes > links > a:hover {
    box-shadow: inset 0 -100px 0 0 var(--hboxColor);
    color: var(--pageBackground);
}

header {
    font-family: "URWClassico", sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    margin-top: 0em;
    margin-bottom: 2em;
    padding-top: 0.5em;
    padding-bottom: 0.2em;
}

header h1 {
    font-weight: 400;
    text-align: center;
    margin: 0em;
}

.intro {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

nav ul {
    padding-left: 0em;
    margin: 0.5em 0em;
}

nav li {
    display: inline;
    list-style-type: none;
    margin: 0em;
    text-align: left;
}

nav li:not(:first-child) {
    padding-left: 0.5em;
}

nav li:not(:last-child) {
    padding-right: 0.5em;
}

footer {
    right: 10px;
    bottom: 20px;
    border-top: 0.1em dotted;
    margin-top: 9em;
    padding-top: 0.3em;
    text-align: right;
}

.school {
    color: var(--emphColor);
}

#pfp {
    width: 20em;
    background-image: linear-gradient(129deg, transparent, var(--pageBackgroundDarker));
    border-radius: 50%;
}

@media screen and (min-width: 960px) {
    #pfp {
        width: 20em;
    }
}

@media screen and (max-width: 480px) {
    #pfp {
        margin-left: 0;
        width: 19em;
    }
}

/* Position the toggle button */
#mode-toggle {
    position: fixed;
    right: 20px;
}

.icon {
    width: 20px;
    height: 20px;
    display: block;
    filter: brightness(0);
}

/* 1. Base Button Styles */
.shadcn-btn {
    /* Layout and positioning */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: var(--bttnColor);

    /* Sizing and shape for regular buttons */
    height: 2.5rem; /* h-10 */
    padding: 0 1rem; /* px-4 */
    border-radius: 0.625rem; /* rounded-md */

    /* Appearance */
    border: 1px solid var(--brdrColor);
    font-size: 0.875rem; /* text-sm */
    font-weight: 500; /* font-medium */
}

/* 2. The crucial ICON modifier */
.shadcn-btn--icon {
    /* Forces a perfect square */
    height: 2.5rem; /* h-10 */
    width: 2.5rem; /* w-10 */

    /* Removes default horizontal padding */
    padding: 0;

    /* Makes it perfectly round if desired */
    border-radius: 0.625rem; /* rounded-full */
}

/* Container for all toast messages */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 300px;
}

/* Individual toast message styling */
.toast {
    background-color: var(--bttnColor);
    color: var(--textColor);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 0.625rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    font-weight: 500;
    font-size: 14px;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    /* Animation properties */
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
    transform: translateY(20px);
}

/* Class added by JS to make the toast visible */
.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.clearfix {
    float: none;
    clear: both;
}

* {
    color: var(--textColor);
}

html {
    background: linear-gradient(200deg, var(--pageBackgroundDarker) 100px, transparent 400px), linear-gradient(175deg, var(--pageBackgroundLighter) 100px, transparent 400px), var(--pageBackground);
    min-height: 100%;
    position: relative;
}

html::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='5' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.14;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: multiply;
}

a,
a:active,
a:visited {
    color: var(--linkColor);
}

code {
    color: var(--codeColor);
    font-size: 120%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--emphColor);
}

h1 a,
h1 a:active,
h1 a:visited,
h2 a,
h2 a:active,
h2 a:visited,
h3 a,
h3 a:active,
h3 a:visited,
h4 a,
h4 a:active,
h4 a:visited,
h5 a,
h5 a:active,
h5 a:visited,
h6 a,
h6 a:active,
h6 a:visited {
    color: var(--emphColor);
}

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

h3 {
    font-size: 1.2em;
}

header a,
header a:active,
header a:visited {
    color: --textColor;
}

header a.active {
    color: var(--emphColor);
}

header a:hover {
    color: var(--emphColor);
    text-decoration: none;
}

@media print {
    footer,
    nav {
        display: none;
        width: 100%;
        margin: 0px;
        padding: 0px;
    }
    a:after {
        content: " '(' attr(href) ') '";
    }
    * {
        color: #000;
    }
    body {
        background-color: #fff;
    }
    body ::-moz-selection {
        background-color: #000;
        color: #fff;
    }
    body ::-selection {
        background-color: #000;
        color: #fff;
    }
    code {
        color: #000;
    }
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        color: #000;
    }
    h1 a,
    h1 a:active,
    h1 a:visited,
    h2 a,
    h2 a:active,
    h2 a:visited,
    h3 a,
    h3 a:active,
    h3 a:visited,
    h4 a,
    h4 a:active,
    h4 a:visited,
    h5 a,
    h5 a:active,
    h5 a:visited,
    h6 a,
    h6 a:active,
    h6 a:visited {
        color: #000;
    }
    h1 a:hover,
    h2 a:hover,
    h3 a:hover,
    h4 a:hover,
    h5 a:hover,
    h6 a:hover {
        background-color: #fff;
        text-decoration: none;
    }
    header a,
    header a:active,
    header a:visited {
        color: #000;
    }
    header a.active {
        color: #000;
    }
    header a:hover {
        color: #000;
        background-color: #fff;
        text-decoration: none;
    }
    footer {
        color: #000;
        border-color: #000;
    }
    footer a,
    footer a:active,
    footer a:visited {
        color: #000;
    }
    .notes ul {
        background: #fff;
    }
    .bibliography table tbody > tr:nth-child(odd),
    .classplan table tbody > tr:nth-child(odd) {
        background: #fff;
    }
    .infotable table {
        background: #fff;
    }
    #mypicture {
        border-color: #000;
    }
}

/* --- Dark Mode Overrides --- */
.dark-mode {
    --pageBackground: oklch(0.145 0 0);
    --pageBackgroundLighter: hsl(from var(--pageBackground) calc(h + 4) calc(s - 15) calc(l - 2.5));
    --pageBackgroundDarker: hsl(from var(--pageBackground) calc(h + 1) calc(s - 10) calc(l + 1.5));

    --emphColor: #e94560;
    --linkColor: #4da6ff;
    --textColor: oklch(0.985 0 0);
    --codeColor: #f48fb1;
    --noteColor: #c4c4cc;
    --hboxColor: #4da6ff;
    --brdrColor: oklch(1 0 0 / 10%);
    --bttnColor: oklch(0.205 0 0);
}

.dark-mode .icon {
    filter: brightness(0) invert(1);
}
