/* Portal pages only. Teaching decks, notebooks and lab instructions keep site.scss. */
body.course-portal {
  --portal-ink: #18243b;
  --portal-muted: #526077;
  --portal-accent: #2457d6;
  --portal-line: #dadfdc;
  --portal-wash: #eaf0ff;
  background: #fbfaf6;
  color: var(--portal-ink);
  font-size: 1.02rem;
  line-height: 1.7;
}
.course-portal #quarto-header .navbar {
  background: #14233f;
  color: #fff;
  border-bottom: 1px solid var(--portal-line);
  box-shadow: none;
}
.course-portal .navbar .navbar-brand,
.course-portal .navbar .nav-link,
.course-portal .navbar .navbar-toggler,
.course-portal .navbar #quarto-search { color: #edf2ff; }
.course-portal .navbar .nav-link.active { color: #e5b45f; font-weight: 700; }
.course-portal .navbar .navbar-toggler-icon { filter: brightness(0) invert(1); }
.course-portal .navbar-brand { font-size: 1.04rem; }
.course-portal a { color: var(--portal-accent); text-underline-offset: 0.2em; }
.course-portal a:hover { color: #173f9e; }
.course-portal :is(a, summary, button):focus-visible { outline: 3px solid #9b6331; outline-offset: 4px; }
.course-portal h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.18; font-weight: 700; }
.course-portal h2 { font-size: clamp(1.4rem, 2.5vw, 1.8rem); margin-top: 2.4rem; }
.course-portal h3 { font-size: 1.18rem; }
.course-portal .quarto-title-block { border-bottom: 1px solid var(--portal-line); padding-bottom: 1rem; margin-bottom: 1.8rem; }
.course-portal .course-hero {
  color: var(--portal-ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--portal-line);
  padding: 1.2rem 0 2rem;
  margin-top: 0;
}
.course-portal .course-hero h1 { max-width: 25ch; font-size: clamp(2.25rem, 5vw, 4rem); line-height: 1.12; }
.course-portal .course-hero .lead { color: var(--portal-muted); max-width: 60ch; line-height: 1.6; }
.course-portal .eyebrow { color: var(--portal-accent); letter-spacing: 0.09em; }
.course-portal .course-motto { max-width: 68ch; color: var(--portal-muted); font-style: italic; margin-top: 1.6rem; }
.course-portal .course-grid { gap: 1.2rem; }
.course-portal .course-card { border: 1px solid var(--portal-line); border-radius: 0.65rem; border-top: 3px solid var(--portal-accent); background: #fff; padding: 1.3rem; min-height: auto; }
.course-portal .course-card p { color: var(--portal-muted); margin-bottom: 0.6rem; }
.course-portal .course-card h3 { font-size: 1.15rem; line-height: 1.35; }
.course-portal .course-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.4rem; }
.course-portal .btn { min-height: 44px; padding: 0.6rem 1rem; border-radius: 0.4rem; font-weight: 600; }
.course-portal .btn-primary { color: white; background: var(--portal-accent); border-color: var(--portal-accent); }
.course-portal .btn-outline-primary { color: var(--portal-accent); border-color: var(--portal-accent); }
.course-portal .btn-outline-primary:hover { color: white; background: var(--portal-accent); }
.course-portal .section-index { border-color: var(--portal-line); }
.course-portal .language-switch { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.35rem; font-size: 0.92rem; margin: 0 0 1rem; }
.course-portal .language-switch a,
.course-portal .language-switch [aria-current] { display: inline-flex; align-items: center; min-height: 44px; padding: 0.3rem 0.7rem; border-radius: 0.35rem; }
.course-portal .language-switch [aria-current] { background: var(--portal-wash); color: var(--portal-ink); font-weight: 700; }
.course-portal .policy-summary { padding: 1.2rem 1.4rem; border-left: 4px solid var(--portal-accent); background: var(--portal-wash); border-radius: 0 0.45rem 0.45rem 0; }
.course-portal .policy-summary p:last-child { margin-bottom: 0; }
.course-portal .availability-note { color: var(--portal-muted); font-size: 0.94rem; }
.course-portal .schedule-table { overflow-x: auto; }
.course-portal .schedule-table table { font-size: 0.94rem; line-height: 1.65; }
.course-portal .schedule-table th { background: var(--portal-wash); color: var(--portal-ink); border-bottom: 2px solid var(--portal-accent); padding: 0.8rem; }
.course-portal .schedule-table td { padding: 1rem 0.8rem; }
/* Russian headings need more room than the English week-number column. */
.course-syllabus-ru .schedule-table :is(th, td, summary, code) {
  overflow-wrap: anywhere;
}
.course-syllabus-ru .schedule-table code { white-space: normal; }
@media (min-width: 901px) {
  .course-syllabus-ru .schedule-table table { min-width: 52rem; }
  .course-syllabus-ru .schedule-table :is(col, th, td):first-child { width: 10% !important; }
  .course-syllabus-ru .schedule-table :is(col, th, td):nth-child(2),
  .course-syllabus-ru .schedule-table :is(col, th, td):nth-child(3) { width: 34% !important; }
  .course-syllabus-ru .schedule-table :is(col, th, td):last-child { width: 22% !important; }
}
.course-portal .schedule-table td:last-child { background: #f0f3fa; }
.course-portal .schedule-table summary { list-style: none; font-weight: 700; cursor: default; line-height: 1.45; margin-bottom: 0.5rem; }
.course-portal .schedule-table summary::-webkit-details-marker { display: none; }
.course-portal .schedule-label { display: none; }
.course-portal .rating-table { border: 1px solid var(--portal-line); border-radius: 0.4rem; }
.course-portal .rating-table th { background: var(--portal-wash); color: var(--portal-ink); }
.course-portal .nav-footer { border-top: 1px solid var(--portal-line); }
@media (max-width: 900px) {
  .course-portal .navbar .nav-link { min-height: 44px; padding-top: 0.6rem; padding-bottom: 0.6rem; }
  .course-portal .course-grid { grid-template-columns: 1fr; }
  .course-portal .schedule-table { overflow: visible; }
  .course-portal .schedule-table table,
  .course-portal .schedule-table tbody { display: block; width: 100%; min-width: 0; }
  .course-portal .schedule-table colgroup { display: none; }
  .course-portal .schedule-table thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
  .course-portal .schedule-table tr { display: block; margin-bottom: 1.25rem; border: 1px solid var(--portal-line); border-radius: 0.6rem; overflow: hidden; background: white; }
  .course-portal .schedule-table td { display: block; width: 100% !important; border: 0; padding: 0.85rem 1rem; text-align: left !important; }
  .course-portal .schedule-table td:first-child { background: var(--portal-wash); border-bottom: 1px solid var(--portal-line); font-weight: 700; }
  .course-portal .schedule-table td:first-child::before { content: 'Week '; }
  .course-portal:lang(ru) .schedule-table td:first-child::before { content: 'Неделя '; }
  .course-portal .schedule-table td:last-child::before { content: 'Lab'; display: block; color: var(--portal-muted); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.35rem; }
  .course-portal:lang(ru) .schedule-table td:last-child::before { content: 'Лабораторная'; }
  .course-portal .schedule-table td + td { border-bottom: 1px solid var(--portal-line); }
  .course-portal .schedule-table summary { cursor: pointer; list-style: disclosure-closed; min-height: 44px; margin: 0; }
  .course-portal .schedule-table details[open] summary { list-style: disclosure-open; margin-bottom: 0.85rem; }
  .course-portal .schedule-table summary::-webkit-details-marker { display: inline; }
  .course-portal .schedule-label { display: block; color: var(--portal-muted); font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.35rem; }
  .course-portal .schedule-table .empty-session { color: var(--portal-muted); }
  .course-portal .rating-table table { min-width: 43rem; }
  .course-portal .rating-table td:first-child { min-width: 19rem; }
}
@media (max-width: 480px) {
  .course-portal .course-hero { padding-top: 0.5rem; }
  .course-portal .course-hero h1 { font-size: 2.25rem; }
  .course-portal .course-actions .btn { flex: 1 1 auto; }
}
@media print {
  .course-portal .language-switch { display: none; }
  .course-portal .schedule-table details { display: block; }
  .course-portal .schedule-table details > :not(summary) { display: block !important; }
}
/* The homepage has its own visible heading; keep Quarto's metadata title for search. */
.course-home #title-block-header { display: none; }
.course-portal #quarto-search button,
.course-portal #quarto-search .aa-SubmitIcon,
.course-portal #quarto-search .aa-DetachedSearchButtonIcon { color: #edf2ff !important; }
.course-portal .course-actions > p { display: flex; flex-wrap: wrap; gap: 0.65rem; margin: 0; width: 100%; }
.course-portal .language-switch > p { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; }

/* Pencil notebook portal. All selectors are scoped away from teaching pages. */
.course-portal { background-image: radial-gradient(#172b4b08 .6px, transparent .7px); background-size: 7px 7px; }
.course-portal .navbar .dropdown-menu { background: #fff; }
.course-portal .navbar .dropdown-item { color: var(--portal-ink); min-height: 44px; }
.course-portal .navbar .nav-link:hover { color: #e5b45f; }
.course-portal .navbar .nav-link:focus-visible { outline-color: #e5b45f; }
.course-portal .section-index { border-radius: 8px 11px 9px 6px; background: #ffffffb8; }
.course-home #quarto-content { max-width: 1240px; margin-inline: auto; }
.course-home main { min-width: 0; }
.course-home .language-switch { margin-bottom: 0; }
.course-home .pencil-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center; padding: 2.5rem 0 3rem; }
.course-home .eyebrow { font-size: .7rem; font-weight: 750; letter-spacing: .13em; color: var(--portal-muted); }
.course-home .pencil-hero h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2.7rem, 4.6vw, 4.2rem); font-weight: 400; line-height: 1.08; letter-spacing: -.045em; margin-bottom: 1.4rem; }
.course-home .pencil-hero h1 em { color: var(--portal-accent); position: relative; display: inline-block; }
.course-home .pencil-hero h1 em::after { content: ''; position: absolute; left: -2%; right: -3%; bottom: -.12em; border-top: 2px solid #2457d6a8; height: 8px; border-radius: 50%; transform: rotate(-3deg); }
.course-home .hero-lead { color: var(--portal-muted); max-width: 34rem; }
.course-home .hero-actions { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; }
.course-home .hero-actions a { min-height: 44px; display: inline-flex; align-items: center; font-size: .9rem; font-weight: 650; }
.course-home .hero-note { color: var(--portal-muted); font: italic 1rem Georgia, serif; margin: 1.5rem 0 0; }
.course-home .hero-art { position: relative; margin: 0; padding: 1.8rem .5rem 1rem; }
.course-home .hero-art img { width: 100%; height: auto; max-height: 340px; object-fit: contain; mix-blend-mode: multiply; }
.course-home .pencil-note, .course-home .hero-art figcaption { font: italic 1rem Georgia, serif; color: #596374; }
.course-home .pencil-note { display: block; transform: rotate(-4deg); }
.course-home .hero-art figcaption { text-align: right; transform: rotate(-3deg); margin-top: .5rem; }
.course-home .resource-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--portal-line); border-radius: 9px 12px 8px 11px; background: #fff; margin-bottom: 3.5rem; }
.course-home .resource-strip a { display: flex; align-items: center; gap: .8rem; padding: 1.2rem 1rem; min-height: 100px; color: var(--portal-ink); text-decoration: none; border-radius: 8px; }
.course-home .resource-strip a + a { border-left: 1px solid var(--portal-line); }
.course-home .resource-strip a:hover { background: #eaf0ff; }
.course-home .resource-icon { font-size: 1.5rem; color: var(--portal-accent); }
.course-home .resource-strip strong { display: block; font-size: .92rem; }
.course-home .resource-strip small { display: block; font-size: .75rem; color: var(--portal-muted); }
.course-home .resource-strip b { margin-left: auto; color: var(--portal-accent); }
.course-home .map-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; }
.course-home .map-heading h2 { font: 400 clamp(1.7rem, 3vw, 2.4rem)/1.2 Georgia, serif; letter-spacing: -.03em; margin: 0; }
.course-home .map-heading .eyebrow { margin-bottom: .5rem; }
.course-home .map-heading > a { flex-shrink: 0; font-size: .85rem; min-height: 44px; display: inline-flex; align-items: center; }
.course-home .map-tools { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 1rem; margin-bottom: .5rem; }
.course-home [hidden] { display: none !important; }
.course-home .map-filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.course-home .map-filters button { border: 1px solid var(--portal-line); border-radius: 5px 7px 4px 6px; background: #fff; padding: .5rem .7rem; min-height: 44px; font-size: .78rem; color: var(--portal-muted); }
.course-home .map-filters button[aria-pressed=true] { background: #14233f; border-color: #14233f; color: white; }
.course-home .map-search { display: grid; gap: .2rem; font-size: .75rem; color: var(--portal-muted); }
.course-home .map-search input { width: 15rem; max-width: 100%; min-height: 44px; border: 1px solid var(--portal-line); border-radius: 6px; background: #fff; padding: .5rem .7rem; color: var(--portal-ink); font-size: .85rem; }
.course-home .map-count { font-size: .75rem; color: var(--portal-muted); margin: .4rem 0 .8rem; }
.course-home .week-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.3rem; }
.course-home .week-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--portal-line); border-radius: 9px 12px 8px 10px; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.course-home .week-card:hover, .course-home .week-card:focus-within { border-color: #2457d6; box-shadow: 0 8px 24px #14233f0d; }
.course-home .week-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .3rem; padding: .9rem 1rem 0; font-size: .65rem; letter-spacing: .04em; font-weight: 700; color: var(--portal-muted); }
.course-home .week-main { color: var(--portal-ink); text-decoration: none; display: block; flex: 1; }
.course-home .week-main::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.course-home .week-art { height: 180px; margin: .5rem 1rem 0; display: flex; align-items: center; justify-content: center; }
.course-home .week-art img { width: 100%; height: 180px; max-height: 180px; min-width: 0; object-fit: contain; }
.course-home .week-copy { padding: 1rem 1.15rem 1.2rem; }
.course-home .week-copy h3 { font-size: 1.12rem; line-height: 1.35; color: var(--portal-ink); margin: 0 0 .5rem; overflow-wrap: anywhere; }
.course-home .week-copy p { color: var(--portal-muted); font-size: .82rem; line-height: 1.6; margin: 0 0 .8rem; }
.course-home .open-label { font-size: .76rem; color: var(--portal-accent); font-weight: 650; }
.course-home .resource-links { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--portal-line); }
.course-home .resource-links > p, .course-home .map-filters > p { display: contents; }
.course-home .resource-links :is(a, .unavailable) { padding: .6rem .9rem; min-height: 44px; display: flex; align-items: center; font-size: .75rem; line-height: 1.4; text-decoration: none; overflow-wrap: anywhere; }
.course-home .resource-links a:hover { background: #eaf0ff; }
.course-home .unavailable { color: #667180; }
.course-home .planned-art { display: grid; place-items: center; color: #8791a1; width: 100%; height: 100%; background: repeating-linear-gradient(0deg, #fbfaf6, #fbfaf6 27px, #e4e8ed 28px); border-radius: 7px; }
.course-home .planned-art span { font: italic 3.5rem Georgia, serif; color: #acb4c1; }
.course-home .planned-art i { font: italic .85rem Georgia, serif; }
.course-home .map-footnote, .course-home .map-empty { font-size: .85rem; color: var(--portal-muted); margin: 1.3rem 0; }
.course-home .pencil-motto { text-align: center; padding: 3rem 1rem; margin-block: 3rem; border-block: 1px solid var(--portal-line); }
.course-home .pencil-motto blockquote { border: 0; max-width: 44rem; margin: 0 auto 1rem; padding: 0; color: var(--portal-ink); font: italic 1.5rem/1.6 Georgia, serif; }
.course-home .pencil-motto a { font-size: .85rem; }
.course-home #week-dialog { background: #fbfaf6; color: var(--portal-ink); width: min(900px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); border: 1px solid var(--portal-line); border-radius: 12px; padding: 3.5rem 2rem 2rem; }
.course-home #week-dialog::backdrop { background: #14233f99; }
.course-home .dialog-close { position: absolute; top: .5rem; right: .6rem; width: 44px; height: 44px; font-size: 1.8rem; color: var(--portal-ink); border: 0; background: transparent; border-radius: 5px; }
.course-home .dialog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 2rem; align-items: center; }
.course-home .dialog-grid > img { width: 100%; height: auto; }
.course-home .dialog-grid h2 { margin-top: 0; }
.course-home .dialog-resources { display: grid; gap: .5rem; margin-block: 1.5rem; }
.course-home .dialog-resources :is(a, span) { display: flex; align-items: center; min-height: 44px; padding: .5rem .8rem; border: 1px solid var(--portal-line); border-radius: 5px; }
@media (max-width: 1100px) {
  .course-home .resource-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-home .resource-strip a:nth-child(3) { border-left: 0; }
  .course-home .resource-strip a:nth-child(n+3) { border-top: 1px solid var(--portal-line); }
}
@media (max-width: 900px) {
  .course-home .week-grid { grid-template-columns: 1fr 1fr; }
  .course-home .pencil-hero { gap: 1rem; }
  .course-home .pencil-hero h1 { font-size: 3rem; }
  .course-home .map-heading { align-items: start; flex-direction: column; }
}
@media (max-width: 600px) {
  .course-home .pencil-hero { grid-template-columns: 1fr; padding-top: 1.2rem; }
  .course-home .pencil-hero h1 { font-size: 2.9rem; }
  .course-home .hero-art { padding-top: .5rem; }
  .course-home .hero-art img { max-height: 220px; }
  .course-home .week-grid { grid-template-columns: 1fr; }
  .course-home .resource-strip a { padding: .8rem; gap: .5rem; }
  .course-home .resource-strip b { display: none; }
  .course-home .map-search, .course-home .map-search input { width: 100%; }
  .course-home .hero-actions { gap: .7rem 1rem; }
  .course-home #week-dialog { padding-inline: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .course-home .week-card { transition: none; }
}
@media (max-width: 380px) {
  .course-home .resource-strip { grid-template-columns: 1fr; }
  .course-home .resource-strip a + a { border-left: 0; border-top: 1px solid var(--portal-line); }
}
