/* Paper pages: an article layout adapted from Jon Barron's website (jonbarron.info). */
/* Source Serif 4 and Lato, both SIL Open Font License, served with the page */
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-weight: 400 700; font-display: fallback;
  src: url('../fonts/source-serif-4/source-serif-4-latin-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-weight: 400 700; font-display: fallback;
  src: url('../fonts/source-serif-4/source-serif-4-latin-ext-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-weight: 400; font-display: fallback;
  src: url('../fonts/source-serif-4/source-serif-4-latin-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-weight: 400; font-display: fallback;
  src: url('../fonts/source-serif-4/source-serif-4-latin-ext-italic.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; font-display: fallback;
  src: url('../fonts/lato/lato-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; font-display: fallback;
  src: url('../fonts/lato/lato-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #ffffff;
  --text: #1c1e21;
  --muted: #5a606b;
  --faint: #8a8f98;
  --border: #e3e4e8;
  --accent: #1a5fb4;
  --accent-hover: #0d47a1;
  --tag-bg: #eef1f6;
  --code-bg: #f6f6f4;
  --sans: 'Lato', 'Segoe UI', -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 18px/1.65 'Source Serif 4', Georgia, 'Times New Roman', serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }


/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
  font: 13.5px/1.4 var(--sans); }
.topbar-inner { max-width: 1220px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 16px; }
.topbar .home { font-weight: 700; color: var(--text); white-space: nowrap; }
.topbar-title { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn { display: inline-flex; align-items: center; padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font: 700 13px/1.4 var(--sans); cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* Contents beside the text */
.page { max-width: 1220px; margin: 0 auto; padding: 36px 24px 72px; display: grid;
  grid-template-columns: 220px minmax(0, 820px); gap: 48px; justify-content: center; }
main { min-width: 0; }
.toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto;
  font: 13px/1.45 var(--sans); }
.toc-head { font-weight: 700; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 5px 0 5px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); }
.toc a:hover, .toc a.active { color: var(--accent); border-left-color: var(--accent); text-decoration: none; }
@media (max-width: 1024px) {
  .page { grid-template-columns: minmax(0, 820px); }
  .toc { display: none; }
}

/* Title block */
.paper-head { text-align: center; margin-bottom: 28px; }
.paper-head h1 { font-size: 2.1rem; line-height: 1.22; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 18px; }
.paper-head p { text-align: center; hyphens: none; }
.authors { font: 15px/1.5 var(--sans); margin: 0 0 4px; }
.authors .me { font-weight: 700; }
.venue { font: 14.5px/1.5 var(--sans); color: var(--muted); margin: 0; }
.authors sup, .contact sup { font-size: 0.75em; margin-left: 1px; }
.affil { font: 14px/1.5 var(--sans); color: var(--muted); margin: 6px 0 0; }
.contact { font: 13.5px/1.5 var(--sans); color: var(--muted); margin: 2px 0 10px; }
.contact a { font: 13px ui-monospace, Consolas, 'Courier New', monospace; }

/* Text */
h2 { font-size: 1.5rem; line-height: 1.3; font-weight: 700; margin: 44px 0 14px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border); display: flex; align-items: baseline; gap: 10px; }
h2 .num { color: var(--muted); font-weight: 600; }
h2 .anchor { margin-left: auto; font: 15px var(--sans); color: var(--faint); opacity: 0; transition: opacity 0.15s; }
h2:hover .anchor { opacity: 1; }
p { margin: 0 0 16px; text-align: justify; hyphens: auto; }
.summary { border: 1px solid var(--border); border-radius: 8px; padding: 20px 26px; margin: 8px 0 36px; font-size: 0.95em; }
.summary-head { font: 700 12px/1.4 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  text-align: center; margin: 0 0 8px; padding: 0; border: 0; display: block; }
.summary p:last-child { margin-bottom: 0; }

/* Figures and movies */
.fig { margin: 28px 0; }
.fig img, .fig video { width: 100%; display: block; border-radius: 6px; }
.fig video { background: #000; }
.fig video.light { background: #fff; }  /* a video drawn on white */
.fig figcaption { font: 14px/1.5 var(--sans); color: var(--muted); margin-top: 8px; }
.fig figcaption b { color: var(--text); }
.credit { color: var(--faint); }
.tag { display: inline-block; font: 700 12px/1.6 var(--sans); color: #3f4a5a; background: var(--tag-bg);
  border-radius: 4px; padding: 0 6px; margin-right: 6px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 28px 0; }
.demo-grid .fig { margin: 0; }
/* A movie alone on its row keeps the size of the movies in pairs and sits in the middle. */
@media (min-width: 701px) {
  .demo-grid > .fig:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc((100% - 24px) / 2); }
}
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: center; margin: 28px 0; }
.pair .fig { margin: 0; }
/* Media side by side at one height: each figure's flex share is its width over its height. */
.row { display: flex; gap: 24px; align-items: flex-start; margin: 28px 0; }
.row .fig { margin: 0; min-width: 0; }
.panels { display: grid; gap: 12px; }
.panels.two { grid-template-columns: 1fr 1fr; align-items: start; }
.panels.two.middle { align-items: center; }
/* Panels at one height: each image's flex share is its width over its height. */
.panels.flex { display: flex; gap: 12px; align-items: flex-start; }
.panels.flex img { min-width: 0; }
.panels img { border-radius: 4px; }
/* Figures narrower than the text, with captions that take fewer lines: beside a narrow or featured figure
   (width --w) the caption sits at its side on wide screens; under a medium one it spans the text. */
.fig.narrow { --w: 420px; }
.fig.feature { --w: 500px; }
.fig.narrow > img, .fig.narrow > video, .fig.feature > img, .fig.feature > video { max-width: var(--w); margin: 0 auto; }
.fig.medium img { max-width: 600px; margin: 0 auto; }
@media (min-width: 701px) {
  .fig.narrow, .fig.feature { display: grid; grid-template-columns: minmax(0, var(--w)) minmax(240px, 1fr);
    gap: 24px; align-items: center; }
  .fig.narrow > img, .fig.narrow > video, .fig.feature > img, .fig.feature > video { max-width: none; }
  .fig.narrow figcaption, .fig.feature figcaption { margin-top: 0; }
}
.stills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stills img { aspect-ratio: 800 / 392; object-fit: cover; border-radius: 4px; }
.stills span { display: block; font: 700 13px/1.4 var(--sans); color: var(--text); margin-top: 4px; }
/* Shape grids: a column per shape with its views as rows named in the first column, or a row per shape under named columns. */
.shapes { display: grid; grid-template-columns: max-content repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(5, auto); gap: 6px 8px; }
.shape { display: grid; grid-row: 1 / span 5; grid-template-rows: subgrid; }
.shape > h3 { font: 700 13px/1.3 var(--sans); text-align: center; margin: 0; align-self: end; }
.shape img, .views img { aspect-ratio: 4 / 3; object-fit: contain; background: #000; border-radius: 4px; }
.shape img.err { aspect-ratio: 6 / 7; }
.labels > span, .views .head > span { font: 12px/1.3 var(--sans); color: var(--muted); }
.labels > span { align-self: center; text-align: right; max-width: 84px; }
.views { display: grid; gap: 8px; }
.views > div { display: grid; grid-template-columns: 64px repeat(4, minmax(0, 1fr)); gap: 8px; align-items: center; }
.views h3 { font: 700 13px/1.3 var(--sans); margin: 0; }
.views .head > span { text-align: center; align-self: end; }
.views img { aspect-ratio: 1 / 1; }

/* BibTeX */
.code { position: relative; }
.code pre { margin: 0; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px;
  font: 13px/1.55 ui-monospace, Consolas, 'Courier New', monospace; overflow-x: auto; }
.code .btn { position: absolute; top: 8px; right: 8px; }

footer { border-top: 1px solid var(--border); padding: 24px; text-align: center; font: 13px/1.5 var(--sans); color: var(--muted); }

/* Linked figures open over the page; the dark area around the figure closes it (article.js). */
.viewer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 56px 3vw 3vh; background: rgba(12, 14, 18, 0.9); cursor: zoom-out; }
.viewer[hidden] { display: none; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5); cursor: default; }
.viewer-close { position: absolute; top: 10px; right: 14px; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16); color: #fff; font: 28px/40px var(--sans); cursor: pointer; }
.viewer-close:hover, .viewer-close:focus-visible { background: rgba(255, 255, 255, 0.32); }
body.viewing { overflow: hidden; }

@media (max-width: 700px) {
  body { font-size: 17px; }
  .page { padding: 24px 16px 56px; }
  .paper-head h1 { font-size: 1.65rem; }
  p { text-align: left; }
  .demo-grid { grid-template-columns: 1fr; }
  .pair { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
  .row .fig { flex: none !important; width: 100%; }
  .panels.two { grid-template-columns: 1fr; }
  .panels.flex { flex-direction: column; }
  .panels.flex img { flex: none !important; width: 100%; }
  .stills { grid-template-columns: 1fr 1fr; }
  .shapes { grid-template-columns: 1fr; grid-template-rows: none; gap: 10px; }
  .shape { grid-row: auto; grid-template-rows: none; grid-template-columns: 1fr 1fr; gap: 6px; }
  .shape > h3 { grid-column: 1 / -1; text-align: left; margin-top: 6px; }
  .labels > span:first-child, .views .head > span:first-child { display: none; }
  .labels > span, .views .head > span { max-width: none; text-align: center; background: var(--tag-bg); border-radius: 4px; padding: 6px; }
  .views > div { grid-template-columns: 1fr 1fr; }
  .views h3 { grid-column: 1 / -1; margin-top: 6px; }
  .topbar-title { display: none; }
  .topbar-inner { padding: 10px 16px; }
}

/* A page whose text Tianyu has not yet confirmed. */
.draft { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: #fef3c7;
  color: #92400e; font: 700 11px/1.7 var(--sans); text-transform: uppercase; letter-spacing: 0.03em; vertical-align: middle; }

/* Nanomaterials page: its three parameter studies at one height, so their stress-strain plots share one scale. */
@media (min-width: 701px) {
  .fig.study { margin-left: auto; margin-right: auto; }
  .fig.study.hg { width: 56.4%; }
  .fig.study.d1 { width: 67.2%; }
}

/* IJSS 2019 page: the opening drawing at its own width, cropped to the two strips, and the deformation
   snapshots as rows of two under named columns, stacked on phones. */
.fig.loop { --w: 480px; }
.fig.loop video { aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 44%; }
.snaps { display: grid; gap: 6px; }
.snaps .cols, .snaps .two-snaps { display: flex; gap: 12px; }
.snaps .cols span { font: 12px/1.3 var(--sans); color: var(--muted); text-align: center; }
.snaps h3 { font: 700 13px/1.3 var(--sans); margin: 10px 0 0; }
.snaps h3 span { font-weight: 400; color: var(--muted); margin-left: 8px; }
.snaps img { min-width: 0; border-radius: 4px; }
@media (max-width: 700px) {
  .snaps .cols { display: none; }
  .snaps .two-snaps { flex-direction: column; }
  .snaps .two-snaps img { flex: none !important; width: 100%; }
}
