/* ==========================================================================
   siyangni.com — content components
   ========================================================================== */

/* ==========================================================================
   Tiles: rounded surfaces for projects, papers, and courses
   ========================================================================== */

.tiles {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
}
.tiles--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); }

.tile {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: clamp(1.25rem, 1rem + 1vw, 2rem);
  background: var(--surface);
  color: var(--body);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.tile p { margin: 0; }
.tile__kicker {
  font-size: var(--t-label);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.tile__title { font-size: var(--t-h3); line-height: 1.25; }
.tile__body { color: var(--ink-soft); }
.tile__foot {
  margin-top: auto;
  padding-top: var(--s-3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-4);
}

/* A whole tile that is a link */
a.tile {
  border-bottom: 1px solid var(--rule-soft);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
a.tile:hover {
  color: var(--body);
  border-color: var(--rule);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.tile__more {
  margin-top: auto;
  padding-top: var(--s-3);
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--accent);
}
.tile__more::after {
  content: "→";
  display: inline-block;
  margin-left: .4em;
  transition: transform var(--dur) var(--ease);
}
a.tile:hover .tile__more::after { transform: translateX(4px); }

/* A small numbered tile used for the three dissertation papers */
.tile__num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--accent);
}

/* Paper entry inside a tile: finding first, formal title second */
.entry__finding { color: var(--ink); font-size: calc(var(--t-body) * 1.04); text-wrap: pretty; }
.entry__title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  line-height: 1.35;
  color: var(--ink-soft);
  font-style: italic;
}
.entry__meta { font-size: var(--t-small); color: var(--muted); }

/* ==========================================================================
   Figure plate
   ========================================================================== */

.plate {
  margin: var(--s-6) 0;
  padding: var(--s-3);
  background: var(--wash);
  border-radius: var(--radius);
}
.plate__frame {
  background: var(--plot-bg);
  border-radius: calc(var(--radius) - 6px);
  padding: var(--s-3);
  box-shadow: var(--shadow-sm);
}
.plate img { display: block; width: 100%; border-radius: 4px; }
.plate figcaption {
  margin-top: var(--s-3);
  padding-inline: var(--s-2);
  font-size: var(--t-small);
  color: var(--muted);
  line-height: 1.45;
}
.plate figcaption strong { color: var(--ink-soft); }

/* On the dark band the plot sits directly on the band. */
.feature .plate { margin: 0; padding: 0; background: none; }
.feature .plate__frame { padding: var(--s-4); }

.gallery {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  margin-top: var(--s-6);
}
.gallery .plate { margin: 0; }

/* ==========================================================================
   Lists
   ========================================================================== */

.dated-list { display: grid; }
.dated {
  display: grid;
  gap: var(--s-1) var(--s-5);
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  padding-block: var(--s-4);
  border-top: 1px solid var(--rule-soft);
}
.dated:first-child { border-top: 0; padding-top: 0; }
.dated__what { color: var(--ink); font-weight: 600; }
.dated__date { font-size: var(--t-small); color: var(--muted); white-space: nowrap; }
.dated__note { grid-column: 1 / -1; font-size: var(--t-small); color: var(--muted); }
@media (max-width: 34rem) {
  .dated { grid-template-columns: 1fr; }
  .dated__date { grid-row: 1; }
}

.materials { list-style: none; margin: 0; padding: 0; display: grid; }
.materials li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-1) var(--s-4);
  padding-block: var(--s-4);
  border-top: 1px solid var(--rule-soft);
}
.materials li:first-child { border-top: 0; padding-top: 0; }
.materials__name { color: var(--ink); font-weight: 600; }
.materials__state { font-size: var(--t-small); color: var(--muted); }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.checks li { position: relative; padding-left: 1.6rem; }
.checks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: .6rem;
  height: .6rem;
  border-radius: 2px;
  background: var(--accent);
  opacity: .8;
}

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chips li {
  font-size: var(--t-small);
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .25em .85em;
}

/* ==========================================================================
   Dissertation: rail layout with a sticky table of contents
   ========================================================================== */

.section__grid { display: grid; gap: var(--s-6); grid-template-columns: minmax(0, 1fr); }
.section__grid > * { min-width: 0; }
@media (min-width: 62rem) {
  .section__grid { grid-template-columns: 14rem minmax(0, 1fr); gap: var(--s-8); align-items: start; }
  .section__head { position: sticky; top: calc(var(--header-h) + var(--s-5)); }
}

.toc { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; gap: var(--s-1); }
.toc a {
  display: block;
  font-size: var(--t-small);
  line-height: 1.4;
  color: var(--ink-soft);
  border: 0;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-sm);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.toc a:hover { color: var(--ink); background: var(--wash-soft); }
.toc__n {
  display: block;
  font-size: var(--t-label);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

.paper { padding-top: var(--s-8); }
.paper:first-child { padding-top: 0; }
.paper + .paper { border-top: 1px solid var(--rule); margin-top: var(--s-8); }

.paper__head { display: grid; gap: var(--s-3); margin-bottom: var(--s-6); max-width: 48rem; }
.paper__kicker { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.paper__title { font-size: var(--t-h2); }
.paper__formal {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}

.block {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-2);
  margin-bottom: var(--s-6);
  max-width: var(--measure);
}
.block__label {
  margin: 0;
  font-size: var(--t-label);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.block ol { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--s-3); }
.block ol li { padding-left: .25rem; }

/* The main finding gets a tinted panel so it can be found at a glance. */
.block--finding {
  max-width: calc(var(--measure) + 4rem);
  padding: var(--s-5) var(--s-5);
  background: var(--accent-tint);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.block--finding .block__label { color: var(--accent); }
.block--finding p:not(.block__label) {
  font-family: var(--font-display);
  font-size: 1.28rem;
  line-height: 1.45;
  color: var(--ink);
  text-wrap: pretty;
}

/* ==========================================================================
   Code
   ========================================================================== */

.code {
  margin: 0;
  padding: var(--s-5);
  background: var(--band);
  color: #e6dfd3;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .85rem;
  line-height: 1.65;
}
.code code { font: inherit; }
.code .c { color: #9a9083; font-style: italic; }
.code .s { color: #e3b4b4; }
.code .f { color: #f4eee5; font-weight: 600; }
code:not(.code code) {
  font-family: var(--font-mono);
  font-size: .88em;
  color: var(--ink);
  background: var(--wash);
  padding: .1em .35em;
  border-radius: 4px;
}

.stack > * + * { margin-top: var(--s-4); }

@media (min-width: 40rem) {
  .tiles--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 72rem) {
  .tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ==========================================================================
   Scroll-driven growth

   assets/js/grow.js sets --expand (0 to 1) on [data-expand] panels and a
   scale on [data-grow] figures. A panel at --expand: 1 reaches the window
   edges: negative side margins of (50vw - 50%) each widen it from the content
   column to the full viewport. Everything stays full size without JS and with
   reduced motion.
   ========================================================================== */

[data-expand] {
  margin-inline: calc(var(--expand, 1) * (50% - 50vw));
  border-radius: calc(var(--radius-lg) * (1 - var(--expand, 1)));
}
[data-grow] { transform-origin: 50% 100%; }
[data-grow-ready] [data-grow] { transition: transform 120ms linear; }

@media (prefers-reduced-motion: reduce) {
  [data-grow] { transform: none !important; }
  [data-expand] { margin-inline: 0; border-radius: var(--radius-lg); }
}

/* Keep a caption clear of the window edge while its figure is expanded. */
[data-expand] figcaption { padding-inline: calc(var(--expand, 1) * var(--shell-pad)); }

