/* Mineral pigments, warm paper, and fine gold edges. */
:root,
:root[data-palette="blue"] {
  color-scheme: light;
  --page: #dce4ef;
  --paper: #ffffff;
  --wash: #f5f9ff;
  --ink: #2b4666;
  --muted: #4d6b8f;
  --deep: #2d568d;
  --link: #2c69b0;
  --pigment: #388fe0;
  --mist: #8bc5f7;
  --gold: #b89143;
  --gold-light: #e8c870;
  --edge: #cfbb8c;
  --on-deep: #ffffff;
  --shadow: #2b70b51a;
  --brush-image: url("../images/landscapes/blue-gold-repeat.png");
  --brush-veil: #ffffff40;
  --frame-start: #e6f1f9;
  --frame-middle: #ffffff;
  --frame-end: #d6e8f5;
  --frame-dots: #6799bb90;
  --frame-inner: #d7c798;
  --frame-corner: #3975a8;
  --frame-glint: #e8c870;
  --frame-shadow: #ac8b4114;
}


:root[data-palette="ink"] {
  color-scheme: dark;
  --page: #121210;
  --paper: #1e1e1c;
  --wash: #292822;
  --ink: #e6e0d5;
  --muted: #bab3a4;
  --deep: #e8c870;
  --link: #e8c870;
  --pigment: #8a7440;
  --mist: #6d6042;
  --gold: #bc9852;
  --gold-light: #e8c870;
  --edge: #7f6a3f;
  --on-deep: #1e1e1c;
  --shadow: #00000066;
  --brush-image: url("../images/landscapes/ink-gold-repeat.png");
  --brush-veil: #12121040;
  --frame-start: #34322a;
  --frame-middle: #22221f;
  --frame-end: #4a4130;
  --frame-dots: #aa8c538c;
  --frame-inner: #a78c52;
  --frame-corner: #dbbd76;
  --frame-glint: #f3dd9b;
  --frame-shadow: #00000040;
}

:root[data-palette="blush"] {
  --page: #efdfd6;
  --paper: #fffaf3;
  --wash: #f5eae2;
  --ink: #493b3a;
  --muted: #7c6261;
  --deep: #6b444a;
  --link: #85505b;
  --pigment: #b48b89;
  --mist: #d9c9a5;
  --gold: #b08750;
  --gold-light: #f0d890;
  --edge: #ccb28f;
  --shadow: #6b444a1a;
  --brush-image: url("../images/landscapes/blush-gold-repeat.png");
  --frame-start: #f6e5e2;
  --frame-middle: #fffafa;
  --frame-end: #ecd3cd;
  --frame-dots: #bb898890;
  --frame-inner: #d7bea0;
  --frame-corner: #b57a7d;
  --frame-glint: #edd3a0;
  --frame-shadow: #ae7d6514;
}

:root[data-palette="green"] {
  --page: #dbe7db;
  --paper: #fafbf5;
  --wash: #eaf0e5;
  --ink: #293e34;
  --muted: #5d7264;
  --deep: #163a2e;
  --link: #2e5e4a;
  --pigment: #4a8a6e;
  --mist: #9aba8e;
  --gold: #ad873b;
  --gold-light: #e8c870;
  --edge: #bdad79;
  --shadow: #163a2e20;
  --brush-image: url("../images/landscapes/green-gold-repeat.png");
  --frame-start: #e7f1e8;
  --frame-middle: #fcfef9;
  --frame-end: #d5e7d8;
  --frame-dots: #6e9a7e90;
  --frame-inner: #c6bc91;
  --frame-corner: #56866b;
  --frame-glint: #dfc780;
  --frame-shadow: #70894514;
}

:root[data-palette="amber"] {
  --page: #eddbc0;
  --paper: #fff9ed;
  --wash: #f4e8d2;
  --ink: #493722;
  --muted: #796349;
  --deep: #5e3a1a;
  --link: #81502c;
  --pigment: #b7833e;
  --mist: #d7b676;
  --gold: #b88638;
  --gold-light: #f0d898;
  --edge: #c8a36b;
  --shadow: #5e3a1a20;
  --brush-image: url("../images/landscapes/amber-gold-repeat.png");
  --frame-start: #f7eedb;
  --frame-middle: #fffdf6;
  --frame-end: #eddbb8;
  --frame-dots: #b7966190;
  --frame-inner: #cdb47c;
  --frame-corner: #af8344;
  --frame-glint: #edd594;
  --frame-shadow: #ad884314;
}

/* Color substitutions only. Existing sizes, borders, shapes, and layout are retained. */
:root {
  --accent-blue: var(--link);
  --page-blue: var(--page);
  --muted-ink: var(--muted);
  --line: var(--edge);
}
body { color: var(--ink); background: var(--page); }
/* A near-white brush wash beneath the original floating shapes. */
html:not([data-edition="classical"]):not([data-palette="ink"]) {
  --page: #ffffff;
  --paper: #ffffff;
}
html:not([data-edition="classical"]) #particles-container {
  background-image: linear-gradient(var(--brush-veil), var(--brush-veil)), var(--brush-image);
  background-size: auto, 820px 820px;
  background-position: center;
  background-repeat: no-repeat, repeat;
}
body > .container {
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border-color: var(--edge);
}
:root:not([data-palette="ink"]) body > .container { background: #ffffff; }
body a, body a:visited, body t, body .fake-link { color: var(--link) !important; }
body a:hover, body a:focus { color: var(--deep) !important; }
body h1, body h2, body h3, body .profile-intro h1,
body .quiz-preview h3, body .seminar-calendar-preview h3 { color: var(--ink); }
body .profile-links a {
  color: var(--link) !important;
  background: var(--wash);
  border-color: var(--edge);
}
body .profile-links a:hover, body .profile-links a:focus {
  color: var(--on-deep) !important;
  background: var(--deep);
  border-color: var(--gold);
}
body .site-nav { background: var(--paper); border-bottom-color: var(--edge); }
body .site-nav a {
  color: var(--link) !important;
  background: var(--wash);
  border-color: var(--edge);
}
body .site-nav a:hover, body .site-nav a:focus,
body .site-nav a[aria-selected="true"] {
  color: var(--link) !important;
  background: var(--paper);
  border-color: var(--edge);
  border-bottom-color: var(--paper);
}
body .site-nav a[aria-selected="true"]::after { background: var(--paper); }
/* Gold on existing dots; no added ornaments or changes to their geometry. */
body .tab-panel li::marker { color: var(--gold); }
body .dot { background-color: color-mix(in srgb, var(--gold-light) 45%, transparent); }
body .site-nav a:focus-visible { outline-color: var(--gold); }
body hr, body h2 { border-color: var(--edge); }
body .subtitle, body .meta { color: var(--muted); }
body details, body .alert, body pre {
  background: var(--wash);
  color: var(--ink);
  border-color: var(--edge);
}
body summary { color: var(--link); }
body .quiz-preview, body .seminar-calendar-preview { background: var(--wash); border-color: var(--edge); }
body .quiz-preview-image, body .seminar-calendar-mark {
  color: var(--link);
  background: var(--wash);
  border-color: var(--edge);
}
body .quiz-preview-kicker, body .seminar-calendar-kicker { color: var(--muted); }
body .quiz-preview-link, body .seminar-calendar-link { background: var(--paper); border-color: var(--edge); }
body .quiz-preview-link:hover, body .seminar-calendar-link:hover { background: var(--wash); }
body .label { color: var(--link); background: var(--wash); }

/* Each resource keeps its own pigment family in every page palette. */
:root {
  --abstract-bg: #f3e2df; --abstract-text: #78454c; --abstract-edge: #ccaaa6;
  --arxiv-bg: #e5eee1; --arxiv-text: #345b43; --arxiv-edge: #a7bda1;
  --paper-bg: #e0edf0; --paper-text: #26586a; --paper-edge: #a0bbc1;
  --video-bg: #f6e8cc; --video-text: #795323; --video-edge: #cbae74;
  --bib-bg: #ece5ef; --bib-text: #655079; --bib-edge: #b9abc6;
}
:root[data-palette="ink"] {
  --abstract-bg: #422e32; --abstract-text: #edbdc1; --abstract-edge: #91686b;
  --arxiv-bg: #293d31; --arxiv-text: #bedcbb; --arxiv-edge: #698065;
  --paper-bg: #293b44; --paper-text: #b9dce7; --paper-edge: #648594;
  --video-bg: #443920; --video-text: #f0d898; --video-edge: #a68b53;
  --bib-bg: #3b3045; --bib-text: #d4c1e4; --bib-edge: #8b729b;
}
body .label-mrdred { color: var(--abstract-text); background: var(--abstract-bg) !important; }
body .label-mrdgreen { color: var(--arxiv-text); background: var(--arxiv-bg) !important; }
body .label-mrdpurple { color: var(--paper-text); background: var(--paper-bg) !important; }
body .label-mrdyellow, body .label-mrdblue { color: var(--video-text); background: var(--video-bg) !important; }
body .label-success { color: var(--bib-text); background: var(--bib-bg) !important; }

/* Classical edition: the approved paintings frame the existing reading column. */
html[data-edition="classical"][data-palette] { --page: #ffffff; --paper: #ffffff; --landscape: url("../images/landscapes/porcelain-blue-distant.png"); }
html[data-edition="classical"][data-palette="blush"] {
  --landscape: url("../images/landscapes/blush-landscape-distant.png");
}
html[data-edition="classical"][data-palette="green"] {
  --landscape: url("../images/landscapes/jade-green-distant.png");
}
html[data-edition="classical"][data-palette="amber"] {
  --landscape: url("../images/landscapes/amber-landscape-distant.png");
}
html[data-edition="classical"] #particles-container {
  opacity: .3;
  background-image: var(--landscape);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
html[data-edition="classical"][data-palette="ink"] {
  --page: #121210;
  --paper: #1e1e1c;
  --landscape: url("../images/landscapes/ink-landscape-distant.png");
}

/* A quiet signature at the end of the classical page. */
.classical-colophon {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin: 28px 0 8px;
}
.classical-colophon p {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .14em;
}
.classical-colophon img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  opacity: .9;
  transform: rotate(-3deg);
}

/* A compact row, on the same scale as the language links. */
.palette-picker {
  display: flex;
  align-items: center;
  gap: .65em;
  margin: 5px 0 0;
  padding: 0;
  border: 0;
  font: inherit;
  line-height: inherit;
}
.palette-picker[hidden] { display: none; }
.palette-heading { display: inline; }
.palette-heading h2 {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  color: #222222;
}
:root[data-palette="ink"] .palette-heading h2 { color: var(--ink); }
.palette-heading h2::after { content: ":"; }
.palette-options { display: inline-flex; align-items: center; gap: .65em; }
.palette-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 1em;
  height: 1em;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}
.palette-button[aria-pressed="true"] { outline: 1px solid var(--gold); outline-offset: 3px; }
.palette-button:hover { outline: 1px solid var(--link); outline-offset: 3px; }
.palette-button:focus-visible, body a:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.palette-swatch {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(125deg, var(--swatch-deep) 0 40%, var(--swatch-mid) 40% 67%, var(--swatch-pale) 67% 86%, var(--swatch-gold) 86%);
}
.palette-name, .palette-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
/* The approved frame retains its geometry; only its colors follow the palette. */
.group-photo-gallery {
  --photo-inset: 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 400px));
  align-items: start;
  gap: 28px 24px;
  width: calc(100% - var(--photo-inset));
  margin: 40px 0 0 var(--photo-inset);
}
html[data-edition="classical"] .group-photo-gallery { --photo-inset: 22px; }
.group-photo {
  width: 100%;
  max-width: 400px;
  margin: 0;
  min-width: 0;
}
.group-photo > .photo-frame {
  display: block;
  position: relative;
  padding: 24px;
  border: 1px solid transparent;
  background: linear-gradient(140deg, var(--frame-start), var(--frame-middle) 42%, var(--frame-end));
  box-shadow: 0 5px 14px var(--frame-shadow);
}
.group-photo > .photo-frame::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px dotted var(--frame-dots);
  pointer-events: none;
}
.group-photo > .photo-frame > img, .group-photo-collage {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
  outline: 1px solid var(--frame-inner);
  outline-offset: 3px;
}
.group-photo-collage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  aspect-ratio: 4 / 3;
  gap: 2px;
  background: var(--frame-middle);
}
.group-photo-collage > a {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.group-photo-collage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.group-photo-collage .portrait-photo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 75%;
  height: 133.333333%;
  transform: translate(-50%, -50%) rotate(-90deg);
}
.photo-frame-corner {
  position: absolute;
  width: 25px;
  height: 25px;
  z-index: 2;
  pointer-events: none;
  background-color: var(--frame-corner);
  -webkit-mask: url("../images/frames/porcelain-corner-original.svg") center / contain no-repeat;
  mask: url("../images/frames/porcelain-corner-original.svg") center / contain no-repeat;
  filter: drop-shadow(.5px .5px 0 var(--frame-glint));
}
.photo-frame-corner.top-left { top: 1px; left: 1px; }
.photo-frame-corner.top-right { top: 1px; right: 1px; transform: rotate(90deg); }
.photo-frame-corner.bottom-right { bottom: 1px; right: 1px; transform: rotate(180deg); }
.photo-frame-corner.bottom-left { bottom: 1px; left: 1px; transform: rotate(270deg); }
.group-photo figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.group-photo-attendees {
  display: block;
  margin-top: 5px;
  color: var(--ink);
}
@media print {
  html, body, body > .container { color: #111; background: #fff; }
  #particles-container, .palette-picker { display: none; }
  body a, body a:visited, body t, body h1, body h2, body h3 { color: #111 !important; }
}
