/* --------------------------------------
   UoE Styling: MSDA Coursebook (Final)
----------------------------------------- */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@600;700&family=Source+Sans+Pro:wght@300;400;600&display=swap');

/* Base body styling */
body {
  font-family: 'IBM Plex Sans', sans-serif;
  background-color: #ffffff;
  color: #111111;
  font-size: 0.9rem;
  line-height: 1.6;
  }

/* Headings */


h1 {
  color: #111111; 
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 2rem;
}

h2 {
  background-color: #E6F0FA;
  padding: 0.4rem 1rem;
  border-left: 5px solid #003366;  /* UoE dark blue */
  color: #003366;
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* H2 headings inside callouts: neutral style */
.callout h2,
.callout-body h2 {
  background-color: #F5F5F5 !important;   /* light grey */
  border-left: 5px solid #999 !important; /* soft grey border */
  color: #111 !important;                 /* black text */
  padding: 0.4rem 1rem !important;
  font-size: 1.2rem !important;           /* same as global h2 */
  font-weight: 700 !important;
  margin-top: 1.2rem !important;
  margin-bottom: 1rem !important;
}

h3 {
  color: #003366;
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.1rem;
  margin-bottom: 1.8rem;
  border-bottom: 2px solid #003366;
  padding: 0.6rem 1rem;
  background-color: #F3F8FC;  /* very light blue */
  border-radius: 4px;
}

h4 {
  color: #444;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 1rem;
   margin-bottom: 1rem;
  padding-left: 0.2rem;
  border-left: 3px solid #003366;
}


.data-title {
  font-size: 1.2rem;
  font-weight: 700;
}

/* Navbar base — keep Bootstrap’s layout, only set colours */
.navbar {
  background-color: #004F71 !important;  /* Muted Blue */
  color: white;
  padding: 0 !important;                /* let container handle spacing */
}

/* Add padding to Quarto's navbar container (safe with Bootstrap) */
.navbar .navbar-container {
  padding: 10px 20px;
}

/* MSDA title / brand */
.navbar .navbar-brand,
.navbar .navbar-logo {
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: white !important;
  font-family: 'Source Sans Pro', sans-serif !important;
  letter-spacing: 0.4px;
  margin-right: 40px;
}

/* Logo styling */
.navbar .navbar-brand img {
  height: 48px !important;
  max-height: 48px !important;
  width: auto !important;
  margin-right: 16px;
  padding-left: 8px;
}

/* Navbar links (Bootstrap 5 / Quarto structure) */
.navbar .navbar-nav .nav-link {
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: white !important;
}

/* Hover + active */
.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .nav-link:focus {
  color: #c5eff7 !important;
}

.navbar .navbar-nav .nav-link.active {
  color: #c5eff7 !important;
}

/* Dropdown menu container */
.navbar .dropdown-menu {
  background-color: #041E42 !important;  /* University Blue */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  border: none;
}

/* Dropdown items (Bootstrap uses .dropdown-item) */
.navbar .dropdown-menu .dropdown-item,
.navbar .dropdown-menu .dropdown-header {
  color: white !important;
  padding: 8px 20px;
  font-weight: 500;
}

.navbar .dropdown-menu .dropdown-item:hover,
.navbar .dropdown-menu .dropdown-item:focus {
  background-color: #004F71 !important;
  color: #c5eff7 !important;
}

/* Non-clickable “header” links (if you use href="#") */
.navbar .dropdown-menu a[href="#"] {
  font-weight: 700;
  color: white !important;
  background-color: #041E42 !important;
  text-transform: uppercase;
  pointer-events: none;
  padding: 10px 20px;
  font-size: 0.85rem;
  border-top: 1px solid #004F71;
}

/* Navbar item spacing (Bootstrap 5: gap supported) */
.navbar .navbar-nav {
  gap: 20px;
}

/* Regular links inside page content */
main.content a {
  color: #007288;
}
main.content a:hover {
  color: #c5eff7;
}

/* Section spacing */
section {
  margin-bottom: 2.5em;
}




/* ============================================================
   CLEAN CALLOUT STYLE (Canvas-like, white interior, coloured bar)
   ============================================================ */


/* slightly larger title if you like */
.callout-title {
  font-size: 0.95rem;
}



/* Base callout box */
.callout {
  position: relative;
  background-color: #ffffff !important;
  border: 1px solid #e5e7eb;
  border-left-width: 6px !important;   /* coloured stripe */
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem !important;
  line-height: 1.6;   /* to match body */
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Remove Quarto's default header styling */
.callout-header {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 0 0.4rem 0 !important;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Title text */
.callout-title {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  font-weight: 650;
  font-size: 0.95rem;
  border: none !important;
  box-shadow: none !important;
}

/* Callout body */
.callout-body {
  padding: 0;   /* already padded in .callout */
  font-size: 0.85rem !important;
  line-height: 1.6;   /* to match body */}

/* Icon next to title */
.callout-icon {
  margin-right: 0.4rem;
  font-size: 1.05rem;
}

/* LEFT BORDER COLOURS */
.callout-tip       { border-left-color: #2E8B57 !important; }  /* green */
.callout-warning   { border-left-color: #DA8A00 !important; }  /* ochre */
.callout-note      { border-left-color: #003366 !important; }  /* navy */
.callout-important { border-left-color: #C5004A !important; }  /* pink */




/* === MARGIN CALLOUT SUPPORT === */

/* Allow margin content in article layout */
.marginnote,
.margin {
  float: right;
  clear: right;
  margin-right: -30%;   /* narrower & aligned */
  width: 24%;           /* compact margin box */
  margin-top: 0;
  font-size: 0.75rem !important;
  line-height: 1.35;   /* to match body */
  color: #666666;       /* soft grey */
}


/* Prevent content from overlapping margin */
main.content {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
}

/* Neutral grey tab styling */
.panel-tabset .nav-tabs {
  border-bottom: 2px solid #cccccc;
  margin-bottom: 1rem;
}

.panel-tabset .nav-tabs .nav-link {
  background-color: #f5f5f5;
  border: 1px solid #d0d0d0;
  border-bottom: none;
  margin-right: 0.3rem;
  padding: 0.4rem 1.1rem;
  font-weight: 500;
  color: #333333;
  border-radius: 6px 6px 0 0;
  transition: background-color 0.2s ease;
}

.panel-tabset .nav-tabs .nav-link:hover {
  background-color: #e2e2e2;
  cursor: pointer;
}

.panel-tabset .nav-tabs .nav-link.active {
  background-color: #ffffff;
  border-color: #d0d0d0 #d0d0d0 #ffffff;
  font-weight: 600;
  color: #111111;
}

.panel-tabset .tab-content {
  border: 2px solid #d0d0d0;
  background-color: #fafafa;
  padding: 1rem 1.25rem;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}



/* --------------------------------------
   Tables – Compact & Clean
----------------------------------------- */

table {
  font-size: 0.75rem;
  line-height: 1.6;
  border-collapse: collapse;
  width: 60%;
  min-width: 400px;
  margin: 1.2rem auto;
}

table th,
table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #ddd;
}

table th {
  background-color: #F3F5F8 !important;
  color: #222 !important;
  font-weight: 600;
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid #d0d7e2;
}

/* Subtle row hover */
table tbody tr:hover {
  background-color: #f8f8f8;
}

/* Optional narrower table utility */
.narrow-table table {
  width: auto;
  min-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* --------------------------------------
   Code Annotation Styling
----------------------------------------- */

/* CSS Variables for consistent colors */
:root {
  --code-bg: #1e2738;                         /* Dark blue background for code */
  --uoe-pink: #C5004A;                        /* UoE pink for highlights/emphasis */
  --highlight-bg: rgba(197, 0, 74, 0.08);     /* Transparent pink for highlights */
  --comment-color: #88cc88;                   /* Bright green for comments */
  --variable-color: #9cdcfe;                  /* Light blue for variables */
  --number-color: #ff8c00;                    /* Orange for numbers */
  --operator-color: #ffffff;                  /* White for operators */
  --string-color: #ce9178;                    /* Orange for strings */
  --function-color: #4ec9b0;                  /* Teal for functions */
  --keyword-color: #c586c0;                   /* Pink for keywords */
}

/* Container for code and annotations */
.code-container {
  position: relative;
  background-color: var(--code-bg);
  color: white;
  font-family: 'Courier New', monospace;
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 2em;
  overflow: visible;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Custom code block display (for manual HTML blocks) */
.code-line {
  white-space: pre;
  position: relative;
  margin: 0;
  padding: 3px 0;
  font-size: 0.85rem;
}

/* Annotation marker (the numbered circles) */
.marker {
  display: inline-block;
  width: 22px;
  height: 22px;
  background-color: var(--uoe-pink);
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 22px;
  font-size: 12px;
  margin-left: 5px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.marker:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Annotation bubble styling for manual HTML blocks */
.annotation {
  display: none;
  position: absolute;
  right: -320px;
  width: 300px;
  background-color: white;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  padding: 12px 15px;
  color: #333;
  z-index: 100;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
  animation: fadeIn 0.2s ease-in-out;
}

/* Animation for smoother appearance */
@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Makes annotation visible when hovering over marker */
.marker:hover + .annotation {
  display: block;
}

/* Styles for Quarto's built-in code annotation system */
.code-annotation-highlight {
  background-color: var(--highlight-bg) !important;
  border-left: 3px solid var(--uoe-pink) !important;
  width: 100% !important;
  display: block !important;
  padding-left: 5px !important;
  margin-left: -5px !important;
  border-radius: 0 !important;
}

/* Ensure the highlight is behind the code text */
.code-annotation-highlight pre {
  background-color: transparent !important;
}

/* Make sure highlight extends fully */
.sourceCode pre.sourceCode code {
  background-color: transparent !important;
}

/* Style Quarto's built-in annotation markers */
.code-annotation-numeric-marker {
  background-color: var(--uoe-pink) !important;
  color: white !important;
  font-weight: bold !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

/* Enhance Quarto's annotation tooltips */
.code-annotation-container {
  background-color: white !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
  padding: 12px 15px !important;
  right: -320px !important;
  width: 300px !important;
  font-family: 'IBM Plex Sans', sans-serif !important;
  animation: fadeIn 0.2s ease-in-out !important;
}

/* === Teaching-Friendly Syntax Colours for R Code === */
.sourceCode {
  font-size: 0.85rem;
  background-color: #f9fafb;
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
}

/* Comments */
.sourceCode .co {
  color: #6a737d; /* soft medium grey */
  font-style: normal; /* no italics for accessibility */
}

/* Keywords like if, else, function */
.sourceCode .kw {
  color: #AF00DB;
  font-weight: 600;
}

/* Strings */
.sourceCode .st {
  color: #22863a;
}

/* Numbers */
.sourceCode .dv {
  color: #D16969;
  font-weight: 500;
}

/* Function names */
.sourceCode .fu {
  color: #005cc5;
  font-weight: 500;
}

/* Variables */
.sourceCode .va {
  color: #b76b00; /* dark amber */
  font-weight: 600;
}

/* Operators like <-, +, * */
.sourceCode .op {
  color: #111111;
}

/* Ensure callout text = body text size */
.callout-body,
.callout-body p,
.callout-body li {
  font-size: 0.85rem !important;
  line-height: 1.6;
}


/* --------------------------------------
   Inline code & footnote-style numbers
   (Option 1 – link-blue code + UoE pink numbers)
----------------------------------------- */

/* Inline code (backticks) */
code:not(.sourceCode) {
  font-family: "Fira Code", "Source Code Pro", monospace;
  color: #007288;               /* same as link colour */
  font-size: 0.9em;
  padding: 0.08em 0.3em;
  background: #E6F0FA;          /* same pale blue as your h2 background */
  border-radius: 3px;
}

/* Superscript numbers (footnotes, hint markers) */
a.footnote-ref,
a[role="doc-noteref"] {
  font-size: 0.85em;
  vertical-align: super;
  color: #C5004A;               /* UoE pink */
  text-decoration: none;
  font-weight: 600;
}

a.footnote-ref:hover,
a[role="doc-noteref"]:hover {
  color: #9E003A;               /* darker pink on hover */
}

/* --------------------------------------
   LIST SPACING + NUMBER SIZE FIX
----------------------------------------- */

/* Numbered lists */
ol {
  font-size: 0.9rem;          /* slightly bigger numbers + text */
  line-height: 1.4;           /* tighter vertical spacing */
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
  padding-left: 1.2rem;   /* default is 2rem */
}


/* Bullet lists */
ul {
  font-size: 0.9rem;          /* match numbered list */
  line-height: 1.4;           /* tighten spacing */
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
}

/* Reduce spacing between list items */
li {
  margin-top: 0.15rem !important;
  margin-bottom: 0.15rem !important;
}

/* For lists inside lists (nested) */
li ul, li ol {
  margin-top: 0.2rem !important;
  margin-bottom: 0.2rem !important;
}

/* Increase size of the actual numbers */
ol li::marker {
  font-size: 1rem !important;        /* bigger numbers */
  font-weight: 600;                  /* match first screenshot */
  color: #003366;                    /* optional: UoE navy */
}

/* Style superscript footnote / hint numbers */
a[role="doc-noteref"], 
.footnote-ref {
  color: #C5004A !important;   /* UoE pink */
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
}

a[role="doc-noteref"]:hover,
.footnote-ref:hover {
  color: #7A0030 !important;    /* darker pink on hover */
}


/* Tighter spacing + bigger numbers in lists
   (use main.content for higher specificity) */
main.content ol,
main.content ul {
  font-size: 0.9rem;       /* match body */
  line-height: 1.4;        /* tighter */
  margin-top: 0.15rem;
  margin-bottom: 0.15rem;
  padding-left: 1.2rem;    /* bring text closer to numbers */
}

main.content li {
  margin-top: 0.1rem !important;
  margin-bottom: 0.1rem !important;
}

/* Quarto wraps list text in <p> inside <li>, so tighten that too */
main.content li p {
  margin-top: 0 !important;
  margin-bottom: 0.1rem !important;
}

/* Make the list numbers themselves a bit larger and stronger */
main.content ol li::marker {
  font-size: 1rem !important;
  font-weight: 600;
  color: #003366;          /* navy to match your headings */
}

a[role="doc-noteref"],
.footnote-ref {
  color: #C5004A !important;   /* UoE pink */
  font-weight: 600;
  font-size: 1rem;           /* same as body */
  text-decoration: none;
}

a[role="doc-noteref"]:hover,
.footnote-ref:hover {
  color: #7A0030 !important;
}

/* --- CLEAN TASK BLOCK (no background, no borders) --- */

.task-block {
  border-left: 4px solid #E0E6ED;   /* subtle vertical bar only */
  padding-left: 1.2rem;
  margin: 1rem 0;
}

/* A1 line: strong, dark, no background */
.task-block .task-main {
  font-size: 1rem;
  font-weight: 700;
  color: #003366;       /* navy text */
  margin-bottom: 0.4rem;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}

/* A2–A5 lines: light grey, small, no background */
.task-block .task-sub {
  font-size: 0.9rem;
  color: #4A5561;        /* softer grey */
  margin: 0.25rem 0;
  font-weight: 400;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}


.footnotes {
  font-size: 0.7rem;
  opacity: 0.4;
  margin-top: 2rem;
}
.footnotes hr {
  display: none;
}


/* --- Tighter R code chunks (Psych-style) -------------------- */

/* Code blocks: less padding, tighter spacing */
.sourceCode {
  font-size: 0.8rem;          /* a touch smaller */
  background-color: #f9fafb;
  border-radius: 4px;
  padding: 0.5rem 0.7rem;     /* was 1rem */
  margin: 0.2rem 0 0.2rem;    /* shrink top/bottom gap */
  line-height: 1.35;          /* slightly tighter lines */
  overflow-x: auto;
}

/* Quarto sometimes wraps code in .cell; trim extra space there too */
.cell {
  margin-top: 0.4rem;
  margin-bottom: 0.8rem;
}

/* Make the “console output” blocks line up with the code above them */
.cell-output pre,
.cell-output .sourceCode {
  margin-top: 0.2rem;
  margin-bottom: 0.4rem;
  padding: 0.4rem 0.6rem;
}
