/* ===== IMPORTS ===== */
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&display=swap");

/* ===== CSS VARIABLES ===== */
:root {
    /* Colors */
    --primary-color: #24384d;
    --secondary-color: #1f4d3a;
    --tertiary-color: #8e44ad;
    --bg-color: #f4f6f8;
    --card-bg: #ffffff;
    --hover-bg: #f8fafc;
    --text-muted: #475569;
    --text-color: #334e68;
    --bg-subtle: #f1f5f9;
    --bg-subtle-hover: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);

    /* Fonts */
    --sans: "Inter", sans-serif;
    --mono: "Google Sans Code", monospace;
}

/* ===== BASE STYLES ===== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--sans);
    color: var(--primary-color);
    margin: 0;
    padding: 40px 20px;
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.6;
}

/* ===== LAYOUT CONTAINERS ===== */
.container {
    max-width: 900px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Section offset for sticky nav */
section, main {
    scroll-margin-top: 100px;
}

main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ===== ACCESSIBILITY ===== */
.skip-link {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    
    /* Decoration (applied on focus) */
    background: var(--tertiary-color);
    color: white;
    z-index: 200;
    font-weight: 500;
    border-radius: 0 0 8px 0;
    text-decoration: none;
}

.skip-link:focus {
    position: fixed; /* Ensures it's visible on top */
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    clip: auto;
    padding: 8px 16px;
    margin: 0;
}

/* ===== NAVIGATION ===== */
nav.menu {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 99px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: center;
    gap: 2rem;
    position: sticky;
    top: 10px;
    z-index: 100;
    margin-bottom: 1rem;
    align-self: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

nav.menu a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

nav.menu a:hover {
    color: var(--tertiary-color);
}

.nav.menu a i {
    color: var(--secondary-color);
    font-size: 0.9em;
    width: 1.25rem;
    text-align: center;
}

nav.breadcrumb {
    padding: 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    width: 100%; /* Ensure it takes full width of container */
}

nav.breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

nav.breadcrumb li:not(:last-child)::after {
    content: "/";
    margin-left: 0.5rem;
    color: var(--text-muted);
    opacity: 0.7;
}

nav.breadcrumb a {
    color: var(--tertiary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

nav.breadcrumb a:hover {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
}

/* ===== TYPOGRAPHY ===== */
header {
    text-align: center;
}

h1 {
    font-weight: 700;
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    letter-spacing: -0.025em;
}

.subheading {
    font-weight: 500;
    font-size: 1.25rem;
    margin: 0 0 1.5rem 0;
    color: var(--secondary-color);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--tertiary-color);
    border-bottom: 1px solid rgba(142, 68, 173, 0.2);
    padding-bottom: 0.5rem;
}

.placeholder-text {
    font-style: italic;
    color: var(--text-muted);
}

#description p {
    font-size: 1.1rem;
    color: var(--text-color);
}

code {
    font-family: var(--mono);
}

/* ===== SECTIONS (CARDS) ===== */
section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.3s ease;
}

section:hover {
    box-shadow: var(--shadow-md);
}

section p:last-child {
    margin-bottom: 0;
}

/* ===== LOGISTICS INFO ===== */
.logistics {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.logistics li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
}

.logistics li i {
    color: var(--tertiary-color);
    font-size: 1.1em;
}

/* ===== TABLES ===== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0;
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--secondary-color);
    border-bottom: 2px solid var(--secondary-color);
    background-color: var(--card-bg);
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: var(--hover-bg);
}

/* Table Column Styles */
/* Date column (1st) */
th:nth-child(1), td:nth-child(1) {
    width: 6rem;
    color: var(--text-muted);
    font-feature-settings: "tnum";
}

/* Topic/Assignment column (2nd) */
th:nth-child(2), td:nth-child(2) {
    font-weight: 500;
}

/* For 2-column tables, make assignment column flexible */
#assignments table th:nth-child(2) {
    width: auto;
}

/* For 3-column tables, constrain topic column */
#schedule table th:nth-child(2) {
    width: 20rem;
}

/* Readings column (3rd) - only applies to 3-column table */
th:nth-child(3), td:nth-child(3) {
    width: auto;
    min-width: 9rem;
    font-size: 0.95em;
}

/* ===== LINKS ===== */
a {
    color: var(--tertiary-color);
    text-decoration: none;
    transition: all 0.2s;
    border-bottom: 1px solid transparent;
}

a:hover {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
}

/* Topic/Assignment column links (slide/assignment links) - 2nd column */
td:nth-child(2) a {
    display: inline-block;
    color: var(--primary-color);
    font-weight: 600;
}

td:nth-child(2) a:hover {
    color: var(--tertiary-color);
}

/* Readings column links (reading links) - 3rd column */
td:nth-child(3) a {
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.9em;
    background: var(--bg-subtle);
    padding: 4px 8px;
    border-radius: 4px;
}

td:nth-child(3) a:hover {
    background: var(--bg-subtle-hover);
    color: var(--primary-color);
    text-decoration: none;
    border-bottom-color: transparent;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    color: var(--primary-color);
    font-size: 0.9rem;
    margin-top: 2rem;
}

footer p {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0;
}

footer a {
    color: var(--secondary-color);
    border-bottom-color: transparent;
}

footer a:hover {
    color: var(--tertiary-color);
    border-bottom-color: var(--tertiary-color);
}

/* ===== MEDIA QUERIES ===== */

/* Tablet and smaller */
@media (max-width: 768px) {
    body {
        padding: 20px 10px;
    }

    nav.menu {
        padding: 0.5rem 1.5rem;
        display: grid;
        grid-template-columns: repeat(2, auto);
        gap: 0.2rem 1.5rem;
        width: fit-content;
        max-width: 90%;
        border-radius: 12px;
        justify-content: center;
    }

    nav.menu a {
        font-size: 0.85rem;
        justify-content: flex-start;
        padding: 0.1rem 0;
    }

    section {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .subheading {
        font-size: 1.1rem;
    }
    
    .logistics {
        gap: 1rem;
        font-size: 1rem;
    }

    /* Make tables scrollable on mobile */
    #schedule, #assignments {
        overflow-x: auto;
    }
    
    #schedule table {
        min-width: 33rem; /* Force scroll if too narrow */
    }

    #assignments table {
        min-width: 19rem; /* Force scroll if too narrow */
    }

    th, td {
        padding: 1rem;
    }

    #description p {
        font-size: 1rem;
    }
}

/* Small mobile and phone-specific adjustments */
@media (max-width: 550px) {
    /* Hide separators on small screens */
    .subheading span[aria-hidden="true"],
    footer span[aria-hidden="true"] {
        display: none;
    }

    /* Stack header spans vertically */
    .subheading span {
        display: block;
        width: 100%;
    }

    /* Stack footer spans vertically */
    footer p span {
        display: block;
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

/* ===== Long-form Content Styles ===== */
#long-form-content {
  line-height: 1.7;
  font-size: 1.1rem;
  color: var(--text-color);
}

#long-form-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--secondary-color);
}

#long-form-content ul {
  list-style-type: disc;
  padding-left: 2rem;
}

#long-form-content li {
  margin-bottom: 0.5rem;
}

#long-form-content blockquote {
  background-color: var(--bg-subtle);
  border-left: 4px solid var(--tertiary-color);
  padding: 0.5em 1em;
  font-style: italic;
  color: var(--text-muted);
  border-radius: 0 8px 8px 0;
  margin: 0.5rem;
}

/* Add extra top margin to all h2 headers in long-form content */
#long-form-content h2 {
  margin-top: 2.5rem;
}
