/* ICDI Modern Learning — Quarto website stylesheet, v1.0
   Unofficial palette. Add after the existing site CSS in _quarto.yml.
   Designed for light Bootstrap themes; dark-mode overrides included. */
:root {
  --ml-purple: #663399;
  --ml-deep: #432568;
  --ml-accent: #8b5cf6;
  --ml-bg: #f8fafc;
  --ml-surface: #ffffff;
  --ml-soft: #f5f3ff;
  --ml-text: #1e293b;
  --ml-muted: #475569;
  --ml-line: #e2e8f0;
  --ml-link: #663399;
  --ml-code-bg: #f6f4fa;
  --ml-shadow: 0 8px 26px rgba(67,37,104,.07);
  --ml-radius: 14px;
}
body.quarto-dark, [data-bs-theme="dark"] {
  --ml-bg: #111827; --ml-surface: #182233; --ml-soft: #29233d;
  --ml-text: #e2e8f0; --ml-muted: #b6c2d1; --ml-line: #384356;
  --ml-link: #c4b5fd; --ml-code-bg: #202a3b;
  --ml-shadow: 0 8px 26px rgba(0,0,0,.16);
}
body:not(.reveal-viewport) {
  background: var(--ml-bg);
  color: var(--ml-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}
/* Navigation — no changes to Quarto's positioning or menu behavior */
#quarto-header .navbar {
  background: linear-gradient(110deg,#432568 0%,#663399 75%,#7042a1 100%);
  --bs-navbar-color: rgba(255,255,255,.92);
  --bs-navbar-hover-color: #fff;
  --bs-navbar-active-color: #fff;
  --bs-navbar-brand-color: #fff;
  --bs-navbar-brand-hover-color: #fff;
  box-shadow: 0 3px 14px rgba(40,20,65,.15);
  padding-block: .65rem;
}
#quarto-header .navbar-brand { color:#fff; font-weight:700; letter-spacing:-.025em; font-size:clamp(.84rem,1.35vw,1.08rem); }
#quarto-header .navbar-title { white-space:normal; line-height:1.3; }
#quarto-header .navbar-nav .nav-link { color:rgba(255,255,255,.92); font-size:.91rem; font-weight:550; border-radius:8px; padding-inline:.7rem; }
#quarto-header .navbar-nav .nav-link:hover, #quarto-header .navbar-nav .nav-link.active, #quarto-header .navbar-nav .nav-link.show { color:#fff; background:rgba(255,255,255,.14); }
#quarto-header .navbar-toggler { color:#fff; border-color:rgba(255,255,255,.4); }
#quarto-header .navbar-toggler-icon { filter:brightness(0) invert(1); }
#quarto-header #quarto-search, #quarto-header .quarto-color-scheme-toggle { color:#fff; }
#quarto-header .dropdown-menu { background:var(--ml-surface); border:1px solid var(--ml-line); border-radius:12px; box-shadow:var(--ml-shadow); padding:.4rem; }
#quarto-header .dropdown-item { color:var(--ml-text); font-size:.88rem; border-radius:7px; padding:.48rem .7rem; white-space:normal; }
#quarto-header .dropdown-item:hover, #quarto-header .dropdown-item:focus, #quarto-header .dropdown-item.active { color:var(--ml-link); background:var(--ml-soft); }
@media (min-width:992px) { #quarto-header .dropdown-menu { max-height:70vh; overflow-y:auto; min-width:16rem; } }
/* Page titles and metadata */
main.content { min-width:0; }
main.content #title-block-header {
  position:relative;
  background:linear-gradient(125deg,#432568,#663399 70%,#7546a9);
  color:white;
  border-radius:var(--ml-radius);
  padding:clamp(1.3rem,3vw,2.5rem);
  box-shadow:var(--ml-shadow);
  margin-bottom:2rem;
}
main.content #title-block-header .quarto-title::before {
  content:'ICDI · CHIANG MAI UNIVERSITY · 888152';
  display:block; font-size:.68rem; font-weight:650; letter-spacing:.12em;
  color:#ede9fe; margin-bottom:.7rem;
}
main.content #title-block-header .title { color:white; font-size:clamp(1.65rem,3.4vw,2.65rem); line-height:1.15; font-weight:750; letter-spacing:-.035em; margin:0; }
main.content #title-block-header :is(.subtitle,.description,.quarto-title-meta,.quarto-title-meta-heading,.quarto-title-meta-contents,.quarto-title-meta a,.quarto-title-author-name) { color:#f1eaff; }
main.content #title-block-header .quarto-title-meta { margin-top:1.2rem; font-size:.83rem; }
main.content #title-block-header .quarto-title-meta-heading { font-size:.66rem; letter-spacing:.08em; opacity:.9; }
main.content :is(h2,h3,h4) { color:var(--ml-text); font-weight:700; letter-spacing:-.025em; line-height:1.3; scroll-margin-top:5rem; }
main.content h2 { margin-top:2.2rem; padding-bottom:.55rem; border-bottom:1px solid var(--ml-line); }
main.content h3 { margin-top:1.7rem; }
main.content a:not(.btn):not(.nav-link):not(.anchorjs-link):not(.code-annotation-anchor):not(#title-block-header a) { color:var(--ml-link); text-underline-offset:.19em; }
/* Sidebar and on-page navigation */
#quarto-sidebar { background:var(--ml-bg); border-color:var(--ml-line); }
#quarto-sidebar .sidebar-item-text { font-size:.88rem; line-height:1.45; }
#quarto-sidebar .sidebar-item-container { border-radius:8px; margin-block:2px; }
#quarto-sidebar .sidebar-item-container:hover { background:var(--ml-soft); }
#quarto-sidebar .sidebar-link { color:var(--ml-muted); padding-block:.38rem; }
#quarto-sidebar .sidebar-link.active { background:var(--ml-soft); color:var(--ml-link); font-weight:700; border-radius:7px; }
#quarto-sidebar .sidebar-item-section > .sidebar-item-container { font-weight:700; }
#quarto-margin-sidebar #TOC { font-size:.84rem; }
#TOC .nav-link { color:var(--ml-muted); line-height:1.45; }
#TOC .nav-link.active { color:var(--ml-link); border-left-color:var(--ml-accent); font-weight:650; }
#toc-title { color:var(--ml-text); font-weight:700; }
/* Tables: applies to ordinary syllabus and content tables, not interactive widgets */
main.content :is(table.table,table.caption-top,table.caption-bottom):not(.gt_table):not(.dataTable):not(.reactable) { --bs-table-bg:var(--ml-surface); --bs-table-color:var(--ml-text); --bs-table-border-color:var(--ml-line); --bs-table-striped-bg:var(--ml-soft); --bs-table-striped-color:var(--ml-text); border:1px solid var(--ml-line); font-size:.88rem; }
main.content :is(table.table,table.caption-top,table.caption-bottom):not(.gt_table):not(.dataTable):not(.reactable) > thead > tr > th { background:#663399; color:#fff; padding:.72rem .65rem; border-color:#8054aa; font-weight:650; vertical-align:middle; }
main.content :is(table.table,table.caption-top,table.caption-bottom):not(.gt_table):not(.dataTable):not(.reactable) > tbody > tr > td { padding:.58rem .65rem; border:1px solid var(--ml-line); vertical-align:top; }
main.content :is(table.table,table.caption-top,table.caption-bottom):not(.gt_table):not(.dataTable):not(.reactable) > tbody > tr:nth-child(even) > td { background:var(--ml-soft); }
main.content .table-responsive { overflow-x:auto; }
/* Static code and R output — leave syntax colors and editor internals alone */
main.content div.sourceCode:not(.qlive-exercise *):not(.webr-exercise *) { background:var(--ml-code-bg); border:1px solid var(--ml-line); border-radius:11px; margin-block:1rem; }
main.content div.sourceCode > pre.sourceCode { background:transparent; margin:0; padding:1rem; }
main.content :is(pre,code) { font-family:'JetBrains Mono','Fira Code',ui-monospace,SFMono-Regular,Consolas,monospace; font-size:.88em; }
main.content p > code, main.content li > code { background:var(--ml-soft); color:var(--ml-link); padding:.12em .35em; border-radius:5px; }
main.content .cell-output-stdout > pre { background:var(--ml-surface); border:1px solid var(--ml-line); border-left:3px solid #059669; padding:.8rem 1rem; border-radius:8px; overflow-x:auto; color:var(--ml-text); }
/* Native Quarto callouts, tabs, figures and quotes */
main.content .callout { border-radius:10px; box-shadow:0 2px 8px rgba(0,0,0,.035); margin-block:1.3rem; }
main.content .callout .callout-header { border-radius:7px 7px 0 0; }
main.content .callout-title { font-weight:700; }
main.content .panel-tabset > .nav-tabs { border-bottom-color:var(--ml-line); gap:.3rem; }
main.content .panel-tabset > .nav-tabs .nav-link { font-size:.9rem; color:var(--ml-muted); border-radius:8px 8px 0 0; }
main.content .panel-tabset > .nav-tabs .nav-link.active { color:var(--ml-link); font-weight:700; background:var(--ml-surface); border-bottom-color:var(--ml-surface); }
main.content .panel-tabset > .tab-content { background:var(--ml-surface); border-color:var(--ml-line); border-radius:0 0 10px 10px; }
main.content blockquote { background:var(--ml-soft); color:var(--ml-muted); border-left:4px solid var(--ml-accent); border-radius:0 10px 10px 0; padding:1rem 1.2rem; }
main.content figure img { border-radius:10px; max-width:100%; }
main.content figcaption { color:var(--ml-muted); font-size:.83rem; }
/* Optional card grid: add .learning-grid and .learning-card in QMD */
main.content .learning-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr)); gap:1rem; margin-block:1.4rem; }
main.content .learning-card { background:var(--ml-surface); border:1px solid var(--ml-line); border-radius:var(--ml-radius); padding:1.25rem; box-shadow:var(--ml-shadow); }
main.content .learning-card h3 { margin-top:0; font-size:1.1rem; }
main.content .learning-card p:last-child { margin-bottom:0; }
/* Embedded presentations: decoration only; preserve existing width and height */
main.content iframe { border:1px solid var(--ml-line); border-radius:10px; max-width:100%; }
.nav-footer { background:var(--ml-surface); color:var(--ml-muted); border-top:1px solid var(--ml-line); font-size:.83rem; }
.nav-footer a { color:var(--ml-link); }
:where(a,button,input,select,textarea):focus-visible { outline:3px solid #8b5cf6; outline-offset:3px; }
@media(max-width:767px) {
  main.content #title-block-header { padding:1.25rem; border-radius:10px; }
  main.content #title-block-header .quarto-title::before { font-size:.61rem; }
  #quarto-header .navbar-brand { max-width:75%; }
  main.content :is(table.table,table.caption-top,table.caption-bottom) { font-size:.82rem; }
}
@media print {
  body { background:white!important; color:black!important; }
  main.content #title-block-header { background:white!important; box-shadow:none; border:1px solid #ddd; }
  main.content #title-block-header :is(.title,.subtitle,.quarto-title-meta,.quarto-title-meta-heading,.quarto-title-meta-contents) { color:black!important; }
  main.content #title-block-header .quarto-title::before { color:#555; }
  main.content table > thead > tr > th { background:#eee!important; color:black!important; }
}
