/* CNTA XVII site style. Colours are set once below; the dark variant follows the visitor's
   system setting. Serif for reading, sans for the frame (header, menu, labels, programme). */

:root {
  --ink: #1c232b;
  --muted: #5b6672;
  --rule: #d8dde2;
  --paper: #fffdf8;                /* cream */
  --tint: #f5f1e8;                 /* background of highlighted rows and cards */
  --band: #1b2a4a;                 /* header band: navy */
  --band-ink: #f4f7fa;
  --accent: #d9962a;               /* gold, used sparingly: current menu item, rules under headings */
  --accent-ink: #946118;           /* darker gold for text and focus outlines (contrast) */
  --heading: #1b2a4a;
  --link: #2a5aa8;
  --serif: "Source Serif 4 Variable", "Source Serif Pro", Charter, "Iowan Old Style", Georgia, serif;
  --sans: "Source Sans 3 Variable", "Source Sans Pro", system-ui, sans-serif;
  --math: "TeX Gyre Pagella Math", "STIX Two Math", "Cambria Math", math;
  --width: 44rem;
  --wide: 72rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e3e7eb;
    --muted: #9ba6b1;
    --rule: #34404b;
    --paper: #13161d;
    --tint: #1d2230;
    --band: #121c33;
    --accent-ink: var(--accent);
    --heading: #f0d9a8;
    --link: #9fbef0;
  }
}

* { box-sizing: border-box; }

html { font-size: 106.25%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--serif);
  font-optical-sizing: auto;
  font-kerning: normal;
}
math { font-family: var(--math); }

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 0.06em;
    text-underline-offset: 0.18em; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
a:hover { text-decoration-color: currentColor; }
/* Firefox misplaces sub/superscripts of MathML inside text-decorated links (Mozilla bug
   667567), so links that contain a formula get their underline as a bottom border instead. */
a:has(math) { text-decoration: none;
               border-bottom: 0.06em solid color-mix(in srgb, currentColor 40%, transparent); }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--paper); padding: 0.3rem 0.6rem; }

/* ---------------------------------------------------------------- header */

.archive-banner {
  margin: 0; padding: 0.5rem 1.25rem; text-align: center;
  background: #f5e6c4; color: #3d2e0b; font: 500 0.9rem/1.4 var(--sans);
}

/* one row: name and dates on the left, the menu on the right (it wraps below on small screens);
   the name links to the home page */
.site-header { background: var(--band); color: var(--band-ink); font-family: var(--sans);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0 2rem; padding: 0.35rem max(1.25rem, calc(50% - var(--wide) / 2 + 1.25rem)); }
.site-header .bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1rem;
                    padding: 0.45rem 0; }
.site-name { color: inherit; text-decoration: none; font-weight: 700; font-size: 1.4rem;
             line-height: 1.2; letter-spacing: 0.02em; }
.site-header .when { opacity: 0.8; font-size: 0.9rem; }
.site-header .when .place::before { content: "· "; }
.nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0 1.3rem; padding: 0; margin: 0; }
.nav a { display: inline-block; padding: 0.85rem 0 0.7rem; color: var(--band-ink); opacity: 0.82;
         text-decoration: none; font-size: 0.95rem; border-bottom: 3px solid transparent; }
.nav a:hover { opacity: 1; }
.nav a[aria-current="page"] { opacity: 1; border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- page body */

main { max-width: var(--width); margin: 0 auto; padding: 0.5rem 1.25rem 3rem; }
main.wide { max-width: var(--wide); }
main.wide > p { max-width: var(--width); }

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 2rem; font-weight: 600; margin: 1.6rem 0 1rem; color: var(--heading); }
h2 { font: 650 1.25rem/1.3 var(--sans); color: var(--heading); margin: 2.2rem 0 0.7rem;
     padding-bottom: 0.25rem; border-bottom: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); }
h3 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 0.4rem; }
p, ul, ol, table { margin: 0 0 1rem; }

table { border-collapse: collapse; }
/* pandoc sets column widths from the dashes under a Markdown table's header; let the browser
   size the columns to their contents instead */
table col { width: auto !important; }
th, td { text-align: left; vertical-align: top; padding: 0.3rem 1.2rem 0.3rem 0;
         border-bottom: 1px solid var(--rule); }
thead th { font: 600 0.85rem var(--sans); color: var(--muted); text-transform: uppercase;
           letter-spacing: 0.05em; }

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

/* ---------------------------------------------------------------- home page */

.hero {
  /* the full width of the window; the text is aligned with the column below */
  min-height: 22rem; padding: 3.5rem max(1.25rem, calc(50% - var(--width) / 2 + 1.25rem)) 3rem;
  display: flex; flex-direction: column; justify-content: flex-end;
  position: relative;
  color: #fff; font-family: var(--sans);
  /* UBC on Point Grey from the south, with the North Shore mountains behind (CC BY 4.0;
     the credit is 'hero-credit:' in site.txt) */
  background:
    linear-gradient(100deg, rgb(20 32 58 / 0.8) 0%, rgb(20 32 58 / 0.42) 45%, rgb(20 32 58 / 0) 80%),
    url(images/photos/ubc-from-the-air.jpg) center 40% / cover no-repeat var(--band);
}
.hero h1 { color: #fff; font: 700 clamp(2.6rem, 8vw, 4.2rem)/1 var(--sans); margin: 0.2rem 0 0.8rem;
           letter-spacing: 0.01em; }
.hero p { margin: 0; text-shadow: 0 1px 3px rgb(0 0 0 / 0.4); }
.hero .series { font-size: 1.05rem; letter-spacing: 0.04em; opacity: 0.92; }
.hero .hero-when { font-size: 1.45rem; font-weight: 600; color: #f2b84b; }
.hero .hero-where { font-size: 1.15rem; opacity: 0.95; }
.hero .credit { position: absolute; right: 0.6rem; bottom: 0.4rem; font-size: 0.72rem; opacity: 0.85; }
.hero .credit a { color: inherit; }
body.home main { padding-top: 1.5rem; }
body.home main > h2:first-of-type { margin-top: 1.5rem; }
/* wide screens: the news in a box beside the main text; the home page then uses the wide
   column, and the banner text lines up with it */
@media (min-width: 64rem) {
  .hero { padding-left: max(1.25rem, calc(50% - var(--wide) / 2 + 1.25rem)); }
  body.home main { max-width: var(--wide); display: grid; grid-template-columns: minmax(0, 1fr) 19rem;
                   column-gap: 3.5rem; align-content: start; }
  body.home main > * { grid-column: 1; }
  body.home main > .news { grid-column: 2; grid-row: 1 / span 30; align-self: start; margin-top: 0.4rem;
                           background: var(--tint); padding: 0.3rem 1.3rem 0.8rem; border-radius: 0.5rem; }
  body.home main > .news h2 { margin-top: 0.8rem; border-bottom: 0; }
  body.home main > h2 { margin-top: 1.8rem; }
  body.home main > ul, body.home main > p { margin-bottom: 0.6rem; }
}

table.dates th { font-weight: 600; white-space: nowrap; font-family: var(--sans); }

.news ul { list-style: none; padding: 0; }
.news li { margin-bottom: 0.9rem; }
.news time { display: block; font: 600 0.75rem var(--sans); letter-spacing: 0.06em; text-transform: uppercase;
             color: var(--accent-ink); }

/* ---------------------------------------------------------------- speakers & abstracts */

ul.speakers { list-style: none; padding: 0; }
ul.speakers li { margin: 0 0 0.8rem; }
.speaker { font-weight: 600; }
.speaker a { color: inherit; }
.affil { display: inline-block; max-width: 100%; color: var(--muted); }
.affil::before { content: "·\00a0"; }

/* Lists of people in pages: '::: people' around a Markdown list, '[affiliation]{.affil}' */
.people ul { list-style: none; padding: 0; }
.people ul:has(> li:nth-child(5)) { columns: 2 17rem; column-gap: 2rem; }   /* longer lists: two columns */
.people li { break-inside: avoid; margin-bottom: 0.3rem; }

article.abstract { margin: 0 0 2rem; scroll-margin-top: 1rem; }
article.abstract h3 { margin-bottom: 0.2rem; }
article.abstract .byline { margin: 0 0 0.2rem; }
article.abstract .when { margin: 0 0 0.6rem; font: 0.9rem var(--sans); color: var(--muted); }
article.abstract .when a { color: inherit; }
article.abstract:target h3 { color: var(--accent-ink); }
.joint { color: var(--muted); }

.links { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.3rem 0; }
a.tag { font: 600 0.8rem/1 var(--sans); text-decoration: none; padding: 0.3rem 0.55rem;
        border: 1px solid var(--rule); border-radius: 0.3rem; }
a.tag:hover { border-color: var(--link); }

/* ---------------------------------------------------------------- programme */

nav.days { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.2rem 0 0.5rem; font-family: var(--sans); }
nav.days a { text-decoration: none; padding: 0.3rem 0.75rem; border: 1px solid var(--rule);
             border-radius: 1rem; font-weight: 600; font-size: 0.9rem; }
nav.days a:hover { border-color: var(--link); }
nav.days a.ics { margin-left: auto; border-style: dashed; font-weight: 400; }

section.day { scroll-margin-top: 1rem; }
.slot { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem;
        padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.slot > .time { font: 600 0.95rem/1.6 var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); }
.slot .kind { display: block; font: 700 0.75rem/1.6 var(--sans); text-transform: uppercase;
              letter-spacing: 0.06em; color: var(--accent-ink); }
.slot .room { display: block; font: 0.85rem var(--sans); color: var(--muted); }
.slot.plenary, .slot.prize, .slot.public { background: var(--tint); border-left: 3px solid var(--accent);
                                           padding-left: 0.6rem; }
.slot.event .what { color: var(--muted); font-style: italic; }

.sessions { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.8rem; }
.session { border: 1px solid var(--rule); border-radius: 0.4rem; padding: 0.6rem 0.8rem; }
.session h3 { font: 650 1rem/1.3 var(--sans); margin: 0; }
.session .room { margin: 0 0 0.4rem; }
.session ol { list-style: none; padding: 0; margin: 0; }
.session li { display: grid; grid-template-columns: 3.2rem 1fr; gap: 0.4rem; padding: 0.35rem 0;
              border-top: 1px solid var(--rule); font-size: 0.95rem; line-height: 1.45; }
.session li:first-child { border-top: 0; }
.session li > .time { font: 600 0.85rem/1.7 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- photos */

.photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.6rem; margin: 1rem 0; }
.photos p { display: contents; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 0.3rem; display: block; }

.photo-float { margin: 0 0 1rem; }
.photo-float figure { margin: 0 0 0.35rem; }
.photo-float img { display: block; width: 100%; height: auto; border-radius: 0.3rem; }
.photo-float p { margin: 0; color: var(--muted); font-size: 0.85rem; }
@media (min-width: 44rem) {
  .photo-float { float: right; width: 45%; margin: 0 0 0.75rem 1.25rem; }
}

/* ---------------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--rule); font: 0.9rem/1.5 var(--sans); color: var(--muted); }
.site-footer > * { max-width: var(--wide); margin-left: auto; margin-right: auto;
                   padding-left: 1.25rem; padding-right: 1.25rem; }
/* Sponsor logos (data/sponsors.txt) are shown exactly as supplied, only scaled: sponsors'
   branding rules (e.g. the Federal Identity Program for the Tutte Institute) forbid recolouring
   them. build.py gives each logo a width in em such that all logos have about the same area, and
   sets --logo-height to the height of the tallest one; the font size of the list sets the scale.
   Each logo is centred in a box of that height (plus a margin), so that the logos line up
   whatever their shapes; notes go below the box. In dark mode the box is a light tile. */
ul.sponsors, ul.sponsor-logos { list-style: none; padding: 0; display: flex; flex-wrap: wrap; align-items: flex-start; }
ul.sponsors { font-size: 1rem; gap: 1.5rem 2.5rem; margin: 1.2rem 0; }
ul.sponsor-logos { font-size: 0.62rem; gap: 0.75rem 1.75rem; margin: 0; }
ul.sponsors li { display: flex; flex-direction: column; gap: 0.4rem; }
ul.sponsors .logo, ul.sponsor-logos .logo { display: flex; align-items: center; justify-content: center;
  height: calc(var(--logo-height, 4em) + 0.6em); border-radius: 0.3rem; }
ul.sponsors img, ul.sponsor-logos img { display: block; height: auto; max-width: 100%; }
@media (prefers-color-scheme: dark) {
  ul.sponsors .logo, ul.sponsor-logos .logo { background: #fbfbf9; padding: 0 0.6em; }
}
ul.sponsors .note { font: 0.85rem var(--sans); color: var(--muted); }
.site-footer .sponsor { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem;
                        padding-top: 1.5rem; padding-bottom: 0.5rem; }
.site-footer .sponsor p { margin: 0; }
body.home .site-footer .sponsor { display: none; }   /* the home page has its own Sponsors section */
.site-footer .meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem;
                     padding-bottom: 1.5rem; }
.site-footer a { color: inherit; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 40rem) {
  html { font-size: 100%; }
  .site-header { padding-bottom: 0.5rem; }
  .nav ul { gap: 0 1rem; }
  .nav a { padding: 0.3rem 0 0.35rem; border-bottom-width: 2px; }
  .hero { min-height: 16rem; padding-top: 2.5rem; padding-bottom: 2rem; }
  .slot { grid-template-columns: 1fr; gap: 0.2rem; }
  nav.days a.ics { margin-left: 0; }
}

/* ---------------------------------------------------------------- print */

@media print {
  .nav, .skip, nav.days { display: none; }
  .site-header { background: none; color: #000; }
  .hero { color: #000; background: none; min-height: 0; padding: 0 1.25rem; }
  .hero h1 { color: #000; }
  .hero p { text-shadow: none; }
  .hero .credit { position: static; }
  .slot, .session { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* ---------------------------------------------------------------- mockup D layout */

@media screen and (width < 52rem) {
  .site-header { padding: 0.35rem 1.25rem 0.5rem; }
  .nav ul { gap: 0 1rem; }
  .nav a { padding: 0.3rem 0 0.35rem; border-bottom-width: 2px; }
}

/* Desktop sidebar. The narrow layout uses the top bar above. */
@media screen and (width >= 52rem) {
  :root { --side: 11.5rem; }
  body { padding-left: var(--side); }
  .site-header { position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 5;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start;
    gap: 0; padding: 1.7rem 0 1rem; overflow-y: auto;
    /* a faded strip of the banner photo at the foot of the sidebar */
    background:
      linear-gradient(to bottom, var(--band) 0, var(--band) 62%, rgb(27 42 74 / 0.55) 82%, rgb(27 42 74 / 0.25) 100%),
      url(images/photos/ubc-from-the-air.jpg) 72% 100% / auto 38% no-repeat var(--band); }
  .site-header .bar { display: block; padding: 0 1.15rem; margin-bottom: 1.3rem; }
  .site-header .bar::after { content: ""; display: block; width: 2.2rem; height: 3px; margin-top: 0.9rem;
                             background: var(--accent); }
  .site-name { display: block; font-size: 1.7rem; line-height: 1.05; }
  .site-header .when { display: block; margin-top: 0.55rem; font-size: 0.85rem; line-height: 1.4; }
  .site-header .when > span { display: block; }
  .site-header .when .place::before { content: none; }
  .nav ul { flex-direction: column; gap: 0; }
  .nav a { display: block; padding: 0.42rem 1.15rem; border-bottom: 0; border-left: 3px solid transparent;
           font-size: 0.95rem; }
  .nav a:hover { background: rgb(255 255 255 / 0.05); }
  .nav a[aria-current="page"] { border-left-color: var(--accent); background: rgb(255 255 255 / 0.07); }
  .site-header :focus-visible { outline-color: var(--accent); outline-offset: -2px; }
  @media (prefers-color-scheme: dark) {
    .site-header { background:
      linear-gradient(to bottom, var(--band) 0, var(--band) 62%, rgb(18 28 51 / 0.6) 82%, rgb(18 28 51 / 0.3) 100%),
      url(images/photos/ubc-from-the-air.jpg) 72% 100% / auto 38% no-repeat var(--band); }
  }

  /* the news goes beside the text only where that leaves a comfortable text column */
  @media (64rem <= width < 74rem) {
    body.home main { display: block; max-width: var(--width); }
    body.home main > .news { margin-top: 0; padding: 0; background: none; border-radius: 0; }
    body.home main > .news h2 { margin-top: 2.2rem;
      border-bottom: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); }
  }

}

/* On the home page the banner goes across the top and the sidebar starts below it, with only
   the menu (the banner has the name and dates). Same HTML: the elements are placed in a grid. */
@media screen and (width >= 52rem) {
  body.home { padding-left: 0; display: grid; grid-template-columns: var(--side) minmax(0, 1fr);
              grid-template-areas: "notice notice" "hero hero" "side main" "side footer"; }
  body.home > .archive-banner { grid-area: notice; }
  body.home > .hero { grid-area: hero; padding-left: 1.15rem; }   /* in line with the menu below */
  body.home > .site-header { grid-area: side; position: sticky; inset: auto; top: 0; align-self: start;
                             width: auto; height: 100vh; height: 100dvh; padding-top: 1.1rem; background: var(--band); }
  body.home > .site-header .bar { display: none; }
  body.home > main { grid-area: main; }
  body.home > .site-footer { grid-area: footer; }
}

/* As the banner scrolls away, the masthead (name, dates, gold rule) unfolds at the top of
   the sidebar. A scroll-driven animation: the banner names its view timeline, timeline-scope
   makes it visible to the sidebar (which is not inside the banner), and the masthead's animation
   follows it, from 40% to 100% of the banner having left the window. Browsers without these
   features and visitors who prefer reduced motion see the menu below the banner. */
@supports (animation-timeline: view()) and (timeline-scope: --x) {
  @media screen and (width >= 52rem) and (prefers-reduced-motion: no-preference) {
    body.home { timeline-scope: --banner; }
    body.home > .hero { view-timeline: --banner block; }
    body.home > .site-header .bar { display: block; overflow: hidden;
      animation: masthead-in linear both; animation-timeline: --banner;
      animation-range: exit 40% exit 100%; }
    body.home > .site-header .bar:focus-within { animation: none; }
  }
}
@keyframes masthead-in {
  from { opacity: 0; max-height: 0; margin-bottom: 0; }
  to   { opacity: 1; max-height: 12rem; margin-bottom: 1.3rem; }
}
