/* ==========================================================================
   1. RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body, h1, h2, h3, h4, p, ul, ol, figure, blockquote {
    margin: 0;
    padding: 0;
}

html {
    font-size: 18px;
    overflow-y: scroll;
}

body {
    margin: 0;
    font-family: "STIX Two Text", "Times New Roman", serif;
    line-height: 1.65rem;
    text-underline-offset: 3px;
    color: var(--body-text);
    background-color: var(--main-background);
}

/* ==========================================================================
   2. THEME VARIABLES (NORD PALETTE)
   ========================================================================== */
:root {
    --nord0: #2e3440;
    --nord1: #3b4252;
    --nord2: #434c5e;
    --nord3: #4c566a;
    --nord4: #d8dee9;
    --nord5: #e5e9f0;
    --nord6: #eceff4;
    --nord7: #8fbcbb;
    --nord8: #88c0d0;
    --nord9: #81a1c1;
    --nord10: #5e81ac;
    --nord11: #bf616a;
    --nord12: #d08770;
    --nord13: #ebcb8b;
    --nord14: #a3be8c;
    --nord15: #b48ead;

    --header-main: var(--nord0);
    --nav-my-name: var(--nord5);
    --nav-text: var(--nord4);
    --nav-text-hover: #ffffff;
    --nav-dropdown-hover: var(--nord3);

    --main-background: var(--nord6);
    --footer-background: var(--nord6);
    --links: #a04e56;
    --horizontal-rule: var(--nord4);
    --table-header-cal: var(--nord8);
    --blue-table-header: var(--nord8);
    --table-background-cal: #ffffff;

    --body-text: var(--nord0);
    --table-background-hwtable: #ffffff;
    --today-cal-color: var(--nord5);
    --schedule-event: #c6e2ee;
}

/* ==========================================================================
   3. LAYOUT & CONTAINERS
   ========================================================================== */
.flex-wrapper {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

/* 1. Unify max-width and center positioning across all wrappers */
.wrapper-header, .wrapper-main, .wrapper-footer {
    width: 100%;
    max-width: 750px;  /* Standardizes total layout width */
    margin: 0 auto;    /* Centers the bounding boxes on wide screens */
}

/* 2. Unify horizontal padding so content starts at the exact same pixel column */
.wrapper-header {
    padding: 0 20px;
}

.wrapper-header, .wrapper-main, .wrapper-footer {
    margin: 0 auto;
}

.wrapper-main {
    max-width: 750px;
    padding: 0 20px 80px 20px;
}

.wrapper-footer {
    padding: 6px 20px; /* Reduced vertical padding */
}

main {
    flex: 1;
    background-color: var(--main-background);
    display: flex;
        align-items: center;      /* Centers .wrapper-main vertically */
    justify-content: center;   /* Centers .wrapper-main horizontally */
}

/* ========================================================================== 
   4. NAVIGATION & HEADER (UPDATED)
   ========================================================================== */ 
header {
  top: 0;
  position: sticky;
  background-color: var(--header-main);
  z-index: 1000;
}

.navbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  flex-wrap: wrap;
  box-sizing: border-box;
  font-family: "Source Sans 3", sans-serif;
}

.try {
  font-size: 1.2rem;
  font-weight: 400;
  font-family: "Source Sans 3", sans-serif;
  flex-grow: 1;
  text-align: left;
  color: var(--nav-my-name);
  padding: 8px 0;
  display: flex;
  align-items: center;
}

.navbar-right {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 0;
}

/* Standalone navigation links keep their outer padding */
.navbar-right > a {
  box-sizing: border-box;
  padding: 10px 20px;
  display: flex;
  align-items: center;
}

/* Dropdown outer wrapper stretches vertically to align with links */
.dropdown {
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  position: relative;
}

.navbar a {
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  color: var(--nav-text);
  text-decoration: none;
  transition: color .2s ease, background-color .2s ease;
}

/* Button expands to handle its own padding, alignment, and transitions */
.dropdown .dropbtn {
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  outline: none;
  font-family: inherit;
  margin: 0;
  color: var(--nav-text);
  cursor: pointer;
  padding: 10px 20px; 
  background-color: transparent; 
  transition: color .2s ease, background-color .2s ease; 
  display: flex;
  align-items: center;
  height: 100%;
  line-height: normal;
}

/* Hovers split up so background color applies directly to the target element */
.navbar-right > a:hover {
  background-color: var(--nord3);
  text-decoration: none;
  color: var(--nav-text-hover);
}

.dropdown:hover .dropbtn {
  background-color: var(--nord3);
  text-decoration: none;
  color: var(--nav-text-hover);
}

.dropdown-content {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  background-color: var(--header-main);
  min-width: 168px;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  z-index: 1100;
}

.dropdown-content a {
  float: none;
  color: var(--nav-text);
  margin: 0;
  padding: 8px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
}

.dropdown-content a:hover {
  text-decoration: none;
  color: #ffffff;
  background-color: var(--nav-dropdown-hover);
}

.dropdown:hover .dropdown-content {
  display: block;
}

/* ==========================================================================
   5. TYPOGRAPHY & HEADINGS
   ========================================================================== */
h1 {
    font-size: 2.2rem;
    margin: 60px 0px 15px 0px;
    font-family: "StIX Two Text", "Times New Roman", serif;
    font-weight: 500;
    text-align: center;
}

h2 {
    font-size: 1.3rem;
    margin: 0 0 20px 0;
    font-weight: 600;
    text-align: center;
}

p, h4, ul, ol {
    font-size: 1rem;
}

p {
    margin: 0 0 16px 0;
}

main a {
    color: var(--links);
    text-decoration: none;
    border-bottom: 1px transparent;
    transition: color 0.2s ease;
}

main a:hover {
    color: var(--body-text);
    text-decoration: underline;
}

a:focus-visible, button:focus-visible {
    outline: 2px solid var(--nord10);
    outline-offset: 3px;
}

/* ==========================================================================
   6. LISTS & SECTIONS
   ========================================================================== */
section:first-of-type {
    padding-top: 2.5rem;
    border-top: 2px solid var(--horizontal-rule);
}

section {
    margin: 1.2rem 0 0.26rem 0;
}

#sylldata {
    padding: 0 0.9rem 2.3rem 0;
    margin: 0 0 2.6rem 0;
    font-size: 1rem;
    font-family: "STIX Two Text", serif;
    border-bottom: 2px solid var(--horizontal-rule);
}

#sylldata ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

#hom ul {
    list-style-type: circle;
    padding: 1px 1px 1px 2.5rem;
}

#hom p {
    margin: 0;
}

.links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1.6rem;
}

.links > section {
    background-color: #ffffff;
    border-radius: 6px;
    padding: 1.5rem;
    margin: 0;
    box-shadow: 0 2px 4px rgba(46, 52, 64, 0.06), 0 4px 12px rgba(46, 52, 64, 0.04);
}

ol {
    margin: 1.2rem 0.5em 1.6rem 0.5em;
    padding: 0;
    list-style-position: inside;
}

ul {
    list-style-type: none;
    margin: 0.26rem 0;
    padding: 0;
}

ol br {
    margin-bottom: 0.4em;
}

ol li {
    color: var(--nord1);
    margin: 0.24rem 0.24rem 1rem 0.24rem;
}

.nested-list {
    list-style-type: none;
  /*  margin: 0 1.2rem; */
}

.nested-list ol {
    counter-reset: mycounter;
}

ol.nested-list > li {
    border: 0;
    margin: 0 0 0.3rem 0; /* 0.3 -> 0.4 */
    display: block;
    counter-increment: mycounter;
}

ol.nested-list > li:before {
    content: "(" counter(mycounter, lower-alpha) ") ";
}

ul li {
    color: var(--nord1);
    margin: 0.4rem 0.24em; /* .4rem .24em */
}

.res {
    margin: 0.7em;
}

li.res {
    margin: 0.64em 0;
}

li.res:first-of-type {
    margin: 0 0 0.64em 0;
}

/* ==========================================================================
   7. UTILITIES & DIVIDERS
   ========================================================================== */
hr {
    border: 0;
    height: 1px;
    background-color: var(--horizontal-rule);
    margin: 1.5rem 0;
}

.cent {
    width: 100%;
}

hr.thin {
    height: 1px;
    border: 0;
    padding: 0;
    margin: 0;
    background-color: var(--nord4);
}

.syll hr {
    margin: 1rem;
}

/* ==========================================================================
   8. HOMEWORK MODULES
   ========================================================================== */
.homework-exercises {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 11px 0 0 0;
    border-bottom: 1px solid var(--nord0);
    margin: 0 10px;
}

.homework {
    margin: 0 10px;
}

.homework ul {
    margin: 0 0 0 2em;
}

.homework h2 {
    margin: 3.1rem 0 2.8rem 0;
    font-size: 1.2rem;
}

.homework section {
    margin: 0;
}

.homework p {
    margin: 0;
}

.homework section:first-of-type {
    padding-top: 0;
    border-top: 0;
}    



/* ==========================================================================
   9. TABLES
   ========================================================================== */
table {
    border-collapse: collapse;
    font-size: 0.7rem;
    table-layout: auto;
    width: 100%;
    color: inherit;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    /* overflow: hidden; */
}

caption {
    font-size: 1.1rem;
    padding: 1rem 0 1.4rem 0;
    font-weight: 500;
    color: var(--nord0);
}

thead, tfoot {
    background-color: var(--blue-table-header);
    color: var(--nord0);
}

th, td {
    border: 1px solid var(--nord4);
    padding: 8px 10px;
}

th {
    font-weight: 600;
}

td:nth-child(4) {
    text-align: left;
}

tbody > tr:nth-of-type(odd) {
    background-color: var(--table-background-hwtable);
}

tbody > tr:nth-of-type(even) {
    background-color: var(--nord5);
}

/* ==========================================================================
   10. FOOTER
   ========================================================================== */
footer {
    border-top: 2px solid var(--horizontal-rule);
    background-color: var(--footer-background);
}

.footer-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    min-height: 1.5rem; /* Shrunk from 2.5rem */
}

footer span {
    font-family: "Source Sans 3", sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--nord3);
}

footer a {
   font-family: "Source Sans 3", sans-serif;
   color: var(--nord3);
    text-decoration: none;
}

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

/* ==========================================================================
   11. PRINT STYLES
   ========================================================================== */
@media print {
    @page {
        size: Letter portrait;
        margin: 0.7in;
    }

    .homework h2 {
        margin: 2.6rem 0 2.1rem 0;
    }

    p, li, body {
        font-size: 15px;
        line-height: 1.4rem;
        color: #000000;
    }

    header, footer, .dropdown {
        display: none !important;
    }

    .theorem, .definition, .lemma, .notation {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .stdg section {
        break-before: page;
        page-break-before: always;
    }

    .stdg section:first-child {
        break-before: avoid;
        page-break-inside: avoid;
    }
}

