/* FoldSketch project page.
   Layout follows the Nerfies template (https://github.com/nerfies/nerfies.github.io), as SketchDeco does, on Bulma 0.9.4.
   Colours are the paper's: sheet paper #f9f8f3, ink #1d1d1f, vertical fold orange #e4572e, horizontal fold blue #2f6fdb. */

:root {
  --ink: #1d1d1f;
  --text: #363636;
  --muted: #5f6368;
  --paper: #f9f8f3;
  --orange: #e4572e;
  --blue: #2f6fdb;
  --dash: #b3b8bf;
  --band: #f1f1ee;
  --hair: #e3e1db;
  --shadow: 62, 50, 39;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #fff;
}

.title, .subtitle, .publication-title, .publication-authors, .button, .tabs, .fold-hint, .proto figcaption {
  font-family: "Google Sans", "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.title { color: var(--ink); }

a { color: #2f6fdb; }
a:hover { color: #1f4fa8; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Ink Free (outlined, see README) ---------- */
svg.ink { display: inline-block; vertical-align: -0.3em; overflow: visible; }

/* ---------- navbar (as on SketchDeco) ---------- */
.navbar { min-height: 3.25rem; background: #fff; }
.navbar .home-link { color: #4a4a4a; }
.navbar .home-link:hover, .navbar .home-link:focus-visible { color: var(--orange); background: transparent; }
.navbar .home-link .icon svg { width: 1.15rem; height: 1.15rem; }
.navbar-burger { color: #4a4a4a; }

/* ---------- hero ---------- */
.hero.top .hero-body { padding: 1.6rem 1.5rem 1.2rem; }
.publication-title { font-weight: 700; letter-spacing: -0.01em; line-height: 1.12; }
.publication-title .name { display: block; font-size: 1.15em; }
.publication-title .sub { display: block; text-wrap: balance; font-weight: 400; font-size: 0.62em; letter-spacing: 0; color: #3c4043; margin-top: 0.35rem; }
.publication-authors { color: #4a4a4a; margin-top: 0.9rem; }
.publication-authors .author-block { display: inline-block; margin: 0 0.35rem; }
.publication-links { margin-top: 1.1rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.publication-links .button { font-weight: 500; }
.publication-links .button .icon svg { width: 1.05em; height: 1.05em; }
.publication-links .button.is-try { background: var(--orange); color: #fff; border-color: transparent; }
.publication-links .button.is-try:hover { background: #cf4520; }

/* ---------- teaser video ---------- */
.hero.teaser .hero-body { padding: 0.6rem 1.5rem 0.5rem; }
.video-wrap { position: relative; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--hair);
  margin: 0 auto; max-width: max(640px, min(1152px, calc((100vh - 335px) * 16 / 9))); }
.video-wrap video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #fff; }
.video-controls { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; }
.vbtn { display: inline-flex; align-items: center; gap: 0.35rem; border: 0; border-radius: 999px; padding: 0.38rem 0.75rem;
  background: rgba(29, 29, 31, 0.74); color: #fff; font: 500 0.82rem/1 "Google Sans", "Noto Sans", sans-serif; cursor: pointer; }
.vbtn:hover { background: rgba(29, 29, 31, 0.9); }
.vbtn svg { width: 15px; height: 15px; fill: currentColor; }
.tagline { text-wrap: balance; max-width: 46rem; margin: 1.6rem auto 0 !important; line-height: 1.55; color: #3c4043; }
.tagline svg.ink { font-size: 1.12em; color: var(--ink); }
.tagline svg.ink.fold-word { color: var(--orange); }

/* ---------- sections ---------- */
.section { padding: 3.4rem 1.5rem; }
.section-head { margin-bottom: 1.4rem; }
.lead { text-wrap: pretty; max-width: 44rem; margin: 0 auto 1.8rem; text-align: center; color: #4a4a4a; line-height: 1.65; }
.content.abstract { max-width: 46rem; margin: 0 auto; line-height: 1.7; }
.subhead { margin-top: 3.2rem !important; }

/* ---------- try it yourself ---------- */
.section.try {
  background-color: var(--band);
  background-image: radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.075) 1px, transparent 1.3px);
  background-size: 22px 22px;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  padding-top: 3rem;
  padding-bottom: 3.2rem;
  overflow: hidden;
}
.try-head { position: relative; text-align: center; margin-bottom: 0.4rem; }
.try-head h2 { margin: 0; line-height: 1; }
.try-head h2 svg.ink { font-size: 3.3rem; color: var(--orange); }
.try-head .swoop { position: absolute; width: 92px; height: 74px; left: calc(50% + 205px); top: 18px; color: var(--orange); }
.fold-hint { text-wrap: balance; text-align: center; color: #4a4a4a; font-size: 1.06rem; max-width: 40rem; margin: 0.7rem auto 2.2rem; line-height: 1.5; }

.fold-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.2rem 1.8rem; max-width: 1100px; margin: 0 auto; }
.fold-card { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; --acc: var(--orange); }
.fold-card.h { --acc: var(--blue); }
.fold-card.is-active { z-index: 3; }

.stage { position: relative; width: 100%; max-width: 236px; aspect-ratio: 1 / 1; perspective: 1100px; transform-style: preserve-3d;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; border-radius: 2px; --fs: 1; }
.stage:focus-visible { outline-offset: 6px; }
.half { position: absolute; overflow: hidden; }
.half > * { position: absolute; inset: 0; pointer-events: none; }
.half .paper { background: var(--paper) url("../images/paper.webp"); }
.half svg { width: 100%; height: 100%; display: block; color: var(--ink); }
.stay { box-shadow: 0 1px 2px rgba(var(--shadow), 0.18), 0 7px 16px -6px rgba(var(--shadow), 0.32); }
.flap { transform-origin: 100% 50%; backface-visibility: visible; -webkit-backface-visibility: visible; will-change: transform;
  box-shadow: 0 1px 2px rgba(var(--shadow), calc(0.18 * var(--fs))), 0 7px 16px -6px rgba(var(--shadow), calc(0.32 * var(--fs))); }
.flap .shade { background: #2a2116; opacity: 0; }
.stay .cast { opacity: 0; }

.stage.v .stay { left: 50%; top: 0; width: 50%; height: 100%; }
.stage.v .flap { left: 0; top: 0; width: 50%; height: 100%; transform-origin: 100% 50%; }
.stage.v .paper { background-size: 200% 100%; }
.stage.v .flap .paper { background-position: left center; }
.stage.v .stay .paper { background-position: right center; }
.stage.v .stay .cast { background: linear-gradient(to right, rgba(40, 30, 20, 0.3), rgba(40, 30, 20, 0.08) 45%, rgba(40, 30, 20, 0) 80%); }
.stage.v .stay::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: rgba(0, 0, 0, 0.07); }

.stage.h .stay { left: 0; top: 50%; width: 100%; height: 50%; }
.stage.h .flap { left: 0; top: 0; width: 100%; height: 50%; transform-origin: 50% 100%; }
.stage.h .paper { background-size: 100% 200%; }
.stage.h .flap .paper { background-position: center top; }
.stage.h .stay .paper { background-position: center bottom; }
.stage.h .stay .cast { background: linear-gradient(to bottom, rgba(40, 30, 20, 0.3), rgba(40, 30, 20, 0.08) 45%, rgba(40, 30, 20, 0) 80%); }
.stage.h .stay::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: rgba(0, 0, 0, 0.07); }

.ghost { position: absolute; opacity: 0; pointer-events: none; border: 1.5px dashed var(--dash); }
.ghost svg { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--acc); }
.stage.v .ghost { left: 0; top: 0; width: 50%; height: 100%; border-right: 0; }
.stage.h .ghost { left: 0; top: 0; width: 100%; height: 50%; border-bottom: 0; }

.labels { position: relative; width: 100%; height: 2.3rem; margin-top: 1rem; font-size: 1.42rem; }
.labels .lab { position: absolute; left: 0; right: 0; top: 0; text-align: center; white-space: nowrap; will-change: opacity, transform; }
.labels .lab.flat { color: var(--ink); }
.labels .lab.folded { color: var(--acc); opacity: 0; }
.fold-card.pop .labels .lab.folded { animation: pop 0.55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(0.85); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* the fold slider: Flat on the left, Fold on the right */
.slide-row { display: flex; align-items: center; justify-content: center; gap: 0.55rem; width: 100%; max-width: 236px; margin-top: 0.3rem; }
.slide-row .end { flex: none; color: #80868b; font-size: 1.02rem; line-height: 1; transition: color 0.2s; }
.slide-row .end.flat.on { color: var(--ink); }
.slide-row .end.fold.on { color: var(--acc); }
.slider { position: relative; flex: 1 1 auto; min-width: 84px; height: 44px; cursor: pointer; touch-action: pan-y;
  -webkit-tap-highlight-color: transparent; border-radius: 22px; --p: 0; }
.slider:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.slider .rail { position: absolute; left: 15px; right: 15px; top: 50%; height: 8px; margin-top: -4px; border-radius: 99px;
  background: #dcd8cf; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.14); overflow: hidden; }
.slider .fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p) * 100%); background: var(--acc); border-radius: inherit; }
.slider .thumb { position: absolute; top: 50%; left: calc(15px + var(--p) * (100% - 30px)); width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border-radius: 50%; background: radial-gradient(circle at 38% 30%, #ffffff, #f4f2ed 62%, #e2ded5);
  border: 1px solid #d0cbc1; box-shadow: 0 2px 3px rgba(var(--shadow), 0.25), 0 6px 12px rgba(var(--shadow), 0.14);
  cursor: grab; transition: transform 0.15s, box-shadow 0.15s; }
.slider .thumb .grip { position: absolute; left: 50%; top: 50%; width: 9px; height: 11px; transform: translate(-50%, -50%);
  border-left: 2px solid rgba(0, 0, 0, 0.22); border-right: 2px solid rgba(0, 0, 0, 0.22); }
.slider:hover .thumb { box-shadow: 0 2px 3px rgba(var(--shadow), 0.28), 0 8px 16px rgba(var(--shadow), 0.18); }
.slider.grabbing, .slider.grabbing .thumb { cursor: grabbing; }
.slider.grabbing .thumb { transform: scale(1.1); }
.slider.hint .thumb { animation: ring 1.25s ease-out 2; }
@keyframes ring { 0% { box-shadow: 0 2px 3px rgba(var(--shadow), 0.25), 0 0 0 0 rgba(228, 87, 46, 0.45); }
  100% { box-shadow: 0 2px 3px rgba(var(--shadow), 0.25), 0 0 0 14px rgba(228, 87, 46, 0); } }

.spark { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; pointer-events: none; color: var(--acc); z-index: 5;
  animation: spark 0.9s cubic-bezier(.2, .7, .3, 1) forwards; }
.spark svg { width: 100%; height: 100%; fill: currentColor; display: block; }
@keyframes spark { 0% { opacity: 0; transform: translate(0, 0) scale(0.3) rotate(0); } 15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(var(--s, 1)) rotate(70deg); } }

#comparison .numbers:last-of-type { margin-bottom: 2.2rem; }
.fold-actions { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; margin-top: 2.3rem; }
.fold-actions .button { font-weight: 500; padding-left: 1.4em; padding-right: 1.4em; }
.fold-actions .button .icon svg { width: 1.1em; height: 1.1em; }
.all-done { height: 2.1rem; font-size: 1.45rem; color: var(--orange); opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s; }
.all-done.on { opacity: 1; transform: none; }
.fold-note { text-align: center; color: #70757a; font-size: 0.86rem; margin-top: 0.4rem; }

@media (max-width: 1023px) {
  .fold-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 600px; gap: 2.2rem 1.4rem; }
  .try-head .swoop { display: none; }
}
@media (max-width: 480px) {
  .section.try { padding-left: 1rem; padding-right: 1rem; }
  .try-head h2 svg.ink { font-size: 2.5rem; }
  .fold-grid { gap: 1.8rem 0.9rem; }
  .labels { font-size: 1.12rem; height: 1.9rem; margin-top: 0.75rem; }
  .slide-row { gap: 0.35rem; }
  .slide-row .end { font-size: 0.9rem; }
  .slider { min-width: 70px; }
  .fold-hint { font-size: 0.98rem; }
}

/* ---------- figures ---------- */
.figure { margin: 0 auto; }
.figure img { display: block; width: 100%; height: auto; margin: 0 auto; }
.figure a.zoom { display: block; cursor: zoom-in; }
.figure figcaption, .caption { margin: 0.9rem auto 0; color: #4a4a4a; font-size: 0.93rem; line-height: 1.6; max-width: 52rem; }
.figure figcaption b, .caption b { color: var(--ink); }
.figure.narrow { max-width: 640px; }
.figure.narrow figcaption { max-width: 640px; }

.pair-tabs { margin-bottom: 1.1rem !important; }
.pair-tabs li a { font-weight: 500; }
.pair-tabs li a:focus { outline: none; }
.pair-tabs li a:focus-visible { outline: 2px solid var(--orange); outline-offset: -5px; border-radius: 999px; }
.dot { display: inline-block; width: 0.62em; height: 0.62em; border-radius: 50%; margin-right: 0.45em; vertical-align: 0.02em; }
.dot.v { background: var(--orange); }
.dot.h { background: var(--blue); }
.tabs.is-toggle li.is-active a { background-color: var(--ink); border-color: var(--ink); }
.tab-pane[hidden] { display: none; }
@media (max-width: 600px) {
  .pair-tabs ul { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border: 0; }
  .pair-tabs.tabs.is-toggle li + li { margin-left: 0; }
  .pair-tabs.tabs.is-toggle li a, .pair-tabs.tabs.is-toggle li:first-child a, .pair-tabs.tabs.is-toggle li:last-child a {
    border-radius: 999px; justify-content: center; white-space: normal; text-align: center; font-size: 0.84rem; padding: 0.45em 0.8em; height: 100%; }
}
.tab-pane img { max-width: 900px; }
.tab-pane .pane-note { text-align: center; color: #4a4a4a; margin-top: 0.8rem; }
.legend-dots { display: flex; gap: 0.4rem 1.6rem; flex-wrap: wrap; justify-content: center; margin: 1.1rem auto 0; color: #4a4a4a; font-size: 0.93rem; }
.legend-dots > span { white-space: nowrap; }
@media (max-width: 480px) { .legend-dots > span { white-space: normal; } }

.proto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; margin: 0 auto; max-width: 1120px; }
.proto figure { margin: 0; }
.proto .photo { position: relative; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px var(--hair); }
.proto img { display: block; width: 100%; height: auto; }
.proto .names { position: relative; height: 1.7rem; margin-top: 0.55rem; font-size: 1rem; color: var(--ink); }
.proto .names span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.proto figcaption { text-align: center; color: #4a4a4a; margin-top: 0.2rem; }
@media (max-width: 768px) { .proto { grid-template-columns: 1fr; max-width: 520px; } }

.parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.3rem 2.4rem; max-width: 52rem; margin: 2.2rem auto 0; }
.parts div { line-height: 1.6; color: #4a4a4a; }
.parts dt { font-family: "Google Sans", "Noto Sans", sans-serif; font-weight: 700; color: var(--ink); font-size: 1.05rem; margin-bottom: 0.2rem; }
.parts dt .sw { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; margin-right: 0.5rem; vertical-align: 0.05em; }
.parts dd { margin: 0; }
@media (max-width: 768px) { .parts { grid-template-columns: 1fr; } }

.numbers { max-width: 44rem; margin: 0 auto 1rem; text-align: center; line-height: 1.7; color: #3c4043; font-size: 1.05rem; }
.numbers strong { color: var(--ink); }

/* ---------- BibTeX ---------- */
.bib-wrap { position: relative; max-width: 52rem; margin: 0 auto; }
pre.bibtex { background: #f6f6f4; border-radius: 10px; padding: 1.2rem 1.3rem; font-size: 0.85rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: #2b2b2b; }
.copy-bib { position: absolute; top: 0.6rem; right: 0.6rem; }

.footer { padding: 2.2rem 1.5rem 3rem; background: #fafafa; border-top: 1px solid #eee; }
.footer p { font-size: 0.88rem; color: #5f6368; }

@media (max-width: 768px) {
  .hero.top .hero-body { padding-top: 0.8rem; }
  .content.abstract { text-align: left !important; }
  .lead, .numbers { text-align: left; }
  .publication-title .sub { font-size: 0.58em; }
  .publication-title { font-size: 2.1rem !important; }
  .section { padding: 2.6rem 1rem; }
  .video-controls { right: 8px; bottom: 8px; }
  .vbtn { padding: 0.32rem 0.6rem; }
  .vbtn .vlabel { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .slider.hint .thumb, .slider .thumb, .fold-card.pop .labels .lab.folded, .spark { animation: none !important; }
  .all-done { transition: none; }
}
