/* ===== POLICY PAGES STYLES =====
   Clean, professional styling for course policy pages
   Color Palette:
   - Orange: #FE7743 (primary accent, highlights)
   - Dark Blue: #273F4F (text, headers, strong contrast)
   - Medium Blue: #447D9B (links, secondary elements)
   - Light Gray: #D7D7D7 (backgrounds, subtle accents)
*/

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: "Georgia", "Times New Roman", serif;
    line-height: 1.6;
    color: #273f4f;
    background: linear-gradient(135deg, #d7d7d7 0%, #ffffff 100%);
    min-height: 100vh;
}

/* ===== MAIN CONTAINER ===== */
/* Create container styling around the body content */
body {
    max-width: 900px;
    margin: 0 auto;
    background: #ffffff;
    box-shadow: 0 0 20px rgba(39, 63, 79, 0.15);
    min-height: 100vh;
    border-left: 4px solid #fe7743;
    border-right: 4px solid #fe7743;
    position: relative;
}

/* ===== HEADER STYLES ===== */
/* Target pandoc's title-block-header */
header#title-block-header {
    background: linear-gradient(135deg, #273f4f 0%, #447d9b 100%);
    color: #ffffff;
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin: 0;
}

header#title-block-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 15px,
        rgba(254, 119, 67, 0.1) 15px,
        rgba(254, 119, 67, 0.1) 17px
    );
    pointer-events: none;
}

/* Style the title */
h1.title {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    color: #fe7743 !important;
}

/* ===== MAIN CONTENT AREA ===== */
/* Style the body content that comes after the header */
body > *:not(header) {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
}

/* Add top padding to the first content element after header */
header#title-block-header + * {
    padding-top: 2.5rem;
}

/* Ensure proper spacing for all content */
body > h2:first-of-type,
body > h3:first-of-type,
body > h4:first-of-type,
body > p:first-of-type,
body > ul:first-of-type,
body > ol:first-of-type,
body > blockquote:first-of-type {
    margin-top: 2.5rem;
}

/* ===== TYPOGRAPHY ===== */
/* Style any h1 in body content that might have the back link */
h1 {
    color: #273f4f;
    font-size: 2.2rem;
    margin-bottom: 1rem;
    font-weight: 400;
    position: relative;
}

h2 {
    color: #447d9b;
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #d7d7d7;
    position: relative;
}

h2::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #fe7743, #447d9b);
}

h3 {
    color: #fe7743;
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

h4 {
    color: #273f4f;
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.6rem;
    font-weight: 600;
}

h5,
h6 {
    color: #447d9b;
    font-size: 1.1rem;
    margin-top: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

p {
    margin-bottom: 1.2rem;
    text-align: justify;
    line-height: 1.7;
}

/* First paragraph after headings */
h1 + p,
h2 + p,
h3 + p,
h4 + p,
h5 + p,
h6 + p {
    margin-top: 0.5rem;
}

/* Back to index link styling - positioned after h1 elements */
.back-link {
    display: block;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 300;
    color: #fe7743 !important;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    padding: 0.3rem 0;
}

/* Different styling for back-link in header */
header + .back-link {
    color: rgba(255, 255, 255, 0.9) !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

header + .back-link:hover {
    color: #fe7743 !important;
    text-shadow: 0 0 4px rgba(254, 119, 67, 0.4);
}

.back-link:hover {
    color: #273f4f !important;
    transform: translateX(-5px);
}

/* ===== LISTS ===== */
ul,
ol {
    margin-left: 2rem;
    margin-bottom: 1.2rem;
}

li {
    margin-bottom: 0.6rem;
    line-height: 1.6;
}

ul li::marker {
    color: #fe7743;
}

ol li::marker {
    color: #447d9b;
    font-weight: 600;
}

/* Nested lists */
ul ul,
ol ol,
ul ol,
ol ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    margin-left: 1.5rem;
}

/* ===== LINKS ===== */
a {
    color: #447d9b;
    text-decoration: none;
    border-bottom: 1px solid rgba(68, 125, 155, 0.3); /* Subtle dotted underline by default */
    transition: all 0.3s ease;
    font-weight: 500;
}

a:hover {
    color: #fe7743;
    border-bottom-color: #fe7743;
    border-bottom-style: solid; /* Change to solid on hover */
    text-shadow: 0 0 1px rgba(254, 119, 67, 0.3);
}

a:visited {
    color: #273f4f;
    border-bottom-color: rgba(
        39,
        63,
        79,
        0.3
    ); /* Subtle underline for visited links */
}

a:active {
    color: #447d9b;
}

/* ===== BLOCKQUOTES ===== */
blockquote {
    background: linear-gradient(
        135deg,
        #d7d7d7 0%,
        rgba(215, 215, 215, 0.3) 100%
    );
    border-left: 6px solid #447d9b;
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    border-radius: 0 8px 8px 0;
    position: relative;
}

blockquote::before {
    content: '"';
    font-size: 4rem;
    color: #fe7743;
    position: absolute;
    top: -10px;
    left: 10px;
    opacity: 0.3;
    font-family: serif;
}

blockquote p {
    margin-bottom: 0.8rem;
}

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

/* ===== CODE ===== */
code {
    background: #d7d7d7;
    color: #273f4f;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: "Monaco", "Menlo", "Courier New", monospace;
    font-size: 0.9rem;
    border: 1px solid rgba(68, 125, 155, 0.2);
}

pre {
    background: linear-gradient(
        135deg,
        #d7d7d7 0%,
        rgba(215, 215, 215, 0.7) 100%
    );
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid #447d9b;
    box-shadow: 0 2px 4px rgba(39, 63, 79, 0.1);
}

pre code {
    background: none;
    padding: 0;
    border: none;
    color: #273f4f;
}

/* ===== TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(39, 63, 79, 0.1);
}

th {
    background: linear-gradient(135deg, #447d9b 0%, #fe7743 100%);
    color: #ffffff;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #d7d7d7;
}

tr:nth-child(even) {
    background: rgba(215, 215, 215, 0.2);
}

tr:hover {
    background: rgba(68, 125, 155, 0.1);
}

/* ===== EMPHASIS ===== */
strong,
b {
    color: #447d9b;
    font-weight: 700;
}

em,
i {
    color: #fe7743;
    font-style: italic;
}

mark {
    background: rgba(254, 119, 67, 0.3);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

/* ===== HORIZONTAL RULES ===== */
hr {
    border: none;
    height: 3px;
    background: linear-gradient(90deg, #d7d7d7, #447d9b, #fe7743, #273f4f);
    margin: 2.5rem 0;
    border-radius: 2px;
}

/* ===== EMBEDDED CONTENT ===== */
iframe {
    max-width: 100%;
    margin: 1.5rem 0;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(39, 63, 79, 0.2);
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(39, 63, 79, 0.15);
    margin: 1rem 0;
}

/* ===== SPECIAL CONTENT BLOCKS ===== */
.warning,
.note,
.info {
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    border-left: 6px solid;
    position: relative;
}

.warning {
    background: rgba(255, 193, 7, 0.1);
    border-left-color: #ffc107;
    color: #856404;
}

.note {
    background: rgba(215, 215, 215, 0.3);
    border-left-color: #447d9b;
    color: #273f4f;
}

.info {
    background: rgba(254, 119, 67, 0.1);
    border-left-color: #fe7743;
    color: #273f4f;
}

/* ===== DATE STAMP ===== */
.date-stamp {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    font-size: 0.85rem;
    color: #447d9b;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid #d7d7d7;
    box-shadow: 0 2px 8px rgba(39, 63, 79, 0.1);
    font-style: italic;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

/* Ensure date stamp doesn't get body padding */
.date-stamp {
    margin: 0;
    padding: 0.5rem 1rem;
}

/* Spacing between different content blocks */
p + ul,
p + ol,
ul + p,
ol + p {
    margin-top: 0.8rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    body {
        margin: 0;
        box-shadow: none;
        border-left: none;
        border-right: none;
        border-top: 4px solid #fe7743;
    }

    header#title-block-header {
        padding: 2rem 1.5rem;
    }

    h1.title {
        font-size: 1.8rem;
    }

    body > *:not(header) {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-top: 2rem;
    }

    h3 {
        font-size: 1.3rem;
    }

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

    pre {
        padding: 1rem;
        font-size: 0.9rem;
    }

    table {
        font-size: 0.9rem;
    }

    th,
    td {
        padding: 0.6rem 0.8rem;
    }

    .date-stamp {
        position: static;
        margin: 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    header#title-block-header {
        padding: 1.5rem 1rem;
    }

    h1.title {
        font-size: 1.5rem;
    }

    body > *:not(header) {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    blockquote {
        padding: 1rem;
        margin: 1rem 0;
    }

    ul,
    ol {
        margin-left: 1.2rem;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white;
        color: black;
        border: none;
        box-shadow: none;
    }

    header#title-block-header {
        background: #273f4f !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        page-break-after: avoid;
    }

    .date-stamp {
        position: static;
        float: right;
        margin-top: 2rem;
        background: white !important;
        border: 1px solid #d7d7d7 !important;
        box-shadow: none !important;
    }

    a {
        color: #273f4f !important;
        text-decoration: underline;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }

    blockquote,
    pre,
    table {
        page-break-inside: avoid;
    }

    @page {
        margin: 2cm;
    }
}
