:root {
  --paper: #ffffff;
  --paper-deep: #eef5f2;
  --surface: #f6f8f7;
  --surface-warm: #fbf5e9;
  --ink: #17211f;
  --muted: #5f6d68;
  --line: #d9e2de;
  --accent: #4ba7a9;
  --accent-deep: #176f73;
  --accent-soft: #e3f4f2;
  --accent-warm: #f0b24b;
  --context-spatial: #9b59b6;
  --context-probabilistic: #228b22;
  --context-temporal: #4169e1;
  --shadow: 0 18px 45px rgba(21, 39, 35, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.25rem;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f7fbfa 0%, var(--surface) 48%, #fffaf2 100%);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: var(--accent-deep);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.peca {
  font-variant: small-caps;
  font-variant-caps: small-caps;
  letter-spacing: 0.025em;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.72rem max(1rem, calc((100vw - 1160px) / 2));
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(217, 226, 222, 0.86);
  box-shadow: 0 1px 18px rgba(21, 39, 35, 0.06);
  backdrop-filter: blur(18px);
}

.brand {
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand .peca {
  text-transform: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
}

nav a {
  padding: 0.36rem 0.55rem;
  color: var(--muted);
  border-radius: 8px;
}

nav a:hover {
  color: var(--accent-deep);
  background: var(--accent-soft);
  text-decoration: none;
}

main {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.4rem 0 4rem;
}

.paper {
  margin: 1rem 0;
  padding: clamp(1.35rem, 3.2vw, 2.7rem);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  padding-top: clamp(1.7rem, 4vw, 3.2rem);
  background:
    linear-gradient(135deg, rgba(227, 244, 242, 0.98), rgba(255, 255, 255, 0.94) 46%, rgba(251, 245, 233, 0.96)),
    var(--paper);
  border-color: rgba(75, 167, 169, 0.22);
  text-align: center;
}

.venue,
.section-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.2rem 0.7rem;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border: 1px solid rgba(75, 167, 169, 0.26);
  border-radius: 999px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-kicker {
  display: flex;
  width: fit-content;
  margin-bottom: 0.85rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 960px;
  margin: 0.95rem auto 0.7rem;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 3.75vw, 3.35rem);
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: break-word;
  text-wrap: balance;
}

h1 span {
  color: var(--accent-deep);
}

.hero-epigraph {
  width: min(680px, 100%);
  margin: 0.8rem auto 1.05rem;
  padding: 0.68rem 1rem 0.58rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.56);
  border-top: 1px solid rgba(75, 167, 169, 0.24);
  border-bottom: 1px solid rgba(240, 178, 75, 0.34);
}

.hero-epigraph blockquote {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-style: italic;
  line-height: 1.35;
}

.hero-epigraph figcaption {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

.hero-epigraph figcaption::before {
  content: "- ";
}

h2 {
  margin-bottom: 0.7rem;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.15;
}

h3 {
  margin-bottom: 0.4rem;
  font-size: 1.02rem;
}

.authors {
  margin-bottom: 0.2rem;
  font-size: 1.16rem;
  font-weight: 700;
}

.authors a {
  color: var(--ink);
  border-bottom: 1px solid rgba(40, 124, 128, 0.28);
}

.authors a:hover {
  color: var(--accent-deep);
  text-decoration: none;
}

.affiliation,
.note,
footer {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin: 1.3rem 0 1.85rem;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-height: 2.55rem;
  padding: 0.56rem 1.05rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.button:hover,
button:hover {
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-color: rgba(75, 167, 169, 0.42);
  text-decoration: none;
  transform: translateY(-1px);
}

.button.primary {
  color: white;
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.button.muted {
  color: var(--accent-deep);
  background: transparent;
}

.hero-figure,
.wide-figure {
  margin: 1rem 0 0;
}

.hero-figure,
.method-overview,
.slide-figure,
.semantic-figure {
  margin-right: auto;
  margin-left: auto;
}

img,
video {
  display: block;
  max-width: 100%;
}

.hero-figure img,
.wide-figure img,
.video-shell {
  width: 100%;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(21, 39, 35, 0.08);
}

.hero-figure img,
.wide-figure img {
  padding: 0.55rem;
}

figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  line-height: 1.35;
}

.section-lead {
  max-width: 900px;
  color: #35423f;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.04rem;
  line-height: 1.72;
}

.method-overview figcaption {
  max-width: 940px;
  margin: 0.65rem auto 0;
  color: #34413f;
  font-size: 0.95rem;
  line-height: 1.55;
}

.context-word {
  font-weight: 850;
}

.context-word-spatial {
  color: var(--context-spatial);
}

.context-word-probabilistic {
  color: var(--context-probabilistic);
}

.context-word-temporal {
  color: var(--context-temporal);
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin: 1.25rem 0 0.8rem;
}

.method-grid article {
  padding: 0.95rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(21, 39, 35, 0.05);
}

.method-grid h3 {
  margin-bottom: 0.35rem;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 1.25;
}

.method-grid article img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  margin-bottom: 0.8rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.context-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  margin: -0.05rem 0 0.45rem;
  padding: 0.18rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-transform: uppercase;
}

.context-spatial {
  color: var(--context-spatial);
  background: rgba(155, 89, 182, 0.11);
}

.context-probabilistic {
  color: var(--context-probabilistic);
  background: rgba(34, 139, 34, 0.11);
}

.context-temporal {
  color: var(--context-temporal);
  background: rgba(65, 105, 225, 0.10);
}

.method-grid p {
  margin-bottom: 0;
  color: #4e5d59;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.93rem;
  line-height: 1.52;
}

.video-shell {
  overflow: hidden;
}

.video-shell video {
  width: 100%;
  background: #111;
}

.result-carousel {
  margin-top: 1.15rem;
}

.carousel-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: rgba(227, 244, 242, 0.48);
  border: 1px solid rgba(75, 167, 169, 0.18);
  border-radius: 8px;
}

.carousel-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.carousel-tabs button,
.carousel-button {
  min-height: 2.15rem;
  padding: 0.38rem 0.72rem;
  font-size: 0.78rem;
}

.carousel-tabs button.is-active {
  color: white;
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.carousel-slide {
  display: block;
}

.carousel-slide[hidden] {
  display: none;
}

.result-carousel.slide-forward .carousel-slide.is-active {
  animation: slide-in-right 260ms ease both;
}

.result-carousel.slide-back .carousel-slide.is-active {
  animation: slide-in-left 260ms ease both;
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(22px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-22px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.carousel-slide h3 {
  margin-top: 0.25rem;
  font-size: 1.28rem;
  line-height: 1.28;
}

.slide-summary {
  max-width: 900px;
  margin: -0.05rem 0 0.95rem;
  color: #4e5d59;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.94rem;
  line-height: 1.5;
}

.result-card {
  margin: 0.85rem 0;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(21, 39, 35, 0.04);
}

.result-card h4,
.results-video h4 {
  margin: 0 0 0.65rem;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.96rem;
  line-height: 1.3;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid rgba(222, 212, 194, 0.72);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

.semantic-figure {
  margin-top: 1rem;
}

.semantic-figure figcaption {
  max-width: 920px;
  margin-right: auto;
  margin-left: auto;
}

.natural-table {
  min-width: 620px;
}

.natural-table tbody td:first-child,
.natural-table tbody td:nth-child(2) {
  text-align: left;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.76rem;
  background: #fff;
}

.wide-table {
  min-width: 1160px;
}

th,
td {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid rgba(217, 226, 222, 0.92);
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.metrics-table:not(.ref-table) tbody td:first-child {
  text-align: left;
}

.metrics-table td:nth-child(2),
.metrics-table th:nth-child(2) {
  text-align: center;
}

.ref-table tbody td:nth-child(2) {
  text-align: left;
}

.ref-table tbody td:first-child {
  color: var(--muted);
  font-weight: 800;
}

.ref-table tbody td.ref-empty {
  color: transparent;
}

.ref-table tbody td[rowspan] {
  text-align: center;
}

td[rowspan] {
  vertical-align: middle;
  font-weight: 800;
  color: var(--muted);
}

thead th {
  color: var(--muted);
  background: rgba(238, 245, 242, 0.8);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-align: center;
}

thead th[colspan] {
  text-align: center;
}

.wide-table thead tr:first-child th:nth-child(3),
.wide-table thead tr:first-child th:nth-child(4),
.wide-table thead tr:nth-child(2) th:nth-child(1),
.wide-table thead tr:nth-child(2) th:nth-child(6),
.wide-table tbody td:nth-child(3),
.wide-table tbody td:nth-child(8) {
  border-left: 2px solid rgba(75, 167, 169, 0.38);
}

tbody tr.highlight {
  background: rgba(75, 167, 169, 0.11);
  font-weight: 800;
}

.tf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  font-weight: 900;
  line-height: 1;
}

.tf.yes {
  color: #11845b;
  background: rgba(17, 132, 91, 0.12);
}

.tf.no {
  color: #c93636;
  background: rgba(201, 54, 54, 0.12);
}

tfoot td {
  color: var(--muted);
  font-size: 0.7rem;
  text-align: left;
}

.results-video {
  margin-top: 1.4rem;
}

.paper-figure-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.pirate-figure {
  margin-top: 0;
}

.slide-figure {
  margin-top: 1rem;
}

@media (min-width: 821px) {
  .hero-figure {
    max-width: 980px;
  }

  .method-overview {
    max-width: 1000px;
  }

  .slide-figure,
  .semantic-figure {
    max-width: 1020px;
  }
}

.citation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 1rem;
  color: #243331;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

footer {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  text-align: center;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
}

@media (max-width: 820px) {
  html {
    scroll-padding-top: 6rem;
  }

  .site-header {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    padding: 0.68rem 1rem 0.62rem;
  }

  nav {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.1rem;
    scrollbar-width: none;
    white-space: nowrap;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  nav a {
    flex: 0 0 auto;
  }

  main {
    width: min(1120px, calc(100% - 1rem));
    padding-top: 0.75rem;
  }

  .paper {
    margin: 0.75rem 0;
    padding: clamp(1rem, 4vw, 1.55rem);
  }

  .hero {
    text-align: left;
  }

  .hero-epigraph {
    margin-left: 0;
    margin-right: 0;
  }

  .authors,
  .affiliation {
    text-align: left;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    gap: 0.5rem;
    margin: 1.15rem 0 1.3rem;
  }

  .actions .button {
    width: 100%;
    min-width: 0;
    min-height: 2.6rem;
    padding: 0.55rem 0.68rem;
    text-align: center;
    white-space: normal;
    line-height: 1.18;
  }

  .method-grid,
  .paper-figure-grid {
    grid-template-columns: 1fr;
  }

  .carousel-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.45rem;
  }

  .carousel-tabs {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    order: -1;
    gap: 0.35rem;
  }

  .carousel-tabs button,
  .carousel-button {
    width: 100%;
    padding-right: 0.45rem;
    padding-left: 0.45rem;
    font-size: 0.74rem;
  }

  .carousel-tabs button {
    flex-direction: column;
    gap: 0.18rem;
    min-height: 3.05rem;
  }

  .carousel-slide h3 {
    font-size: 1.12rem;
  }

  .result-card {
    padding: 0.8rem;
  }

  .table-scroll {
    margin-right: -0.15rem;
    margin-left: -0.15rem;
  }

  h1 {
    margin-left: 0;
    margin-right: 0;
    font-size: clamp(1.6rem, 6vw, 2.35rem);
    line-height: 1.12;
  }
}

@media (max-width: 520px) {
  body {
    line-height: 1.55;
  }

  .site-header {
    padding-right: 0.7rem;
    padding-left: 0.7rem;
  }

  main {
    width: 100%;
    padding: 0.45rem 0.55rem 3rem;
  }

  .paper {
    border-radius: 8px;
  }

  .venue,
  .section-kicker {
    min-height: 1.6rem;
    padding: 0.18rem 0.55rem;
    font-size: 0.68rem;
  }

  .section-kicker {
    margin-bottom: 0.7rem;
  }

  h2 {
    font-size: 1.38rem;
  }

  h1 {
    font-size: clamp(1.45rem, 6.3vw, 1.8rem);
    line-height: 1.14;
    overflow-wrap: anywhere;
    text-wrap: auto;
  }

  .section-lead {
    font-size: 0.96rem;
    line-height: 1.62;
  }

  .hero-epigraph {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  .hero-figure img,
  .wide-figure img {
    padding: 0.35rem;
  }

  .method-grid article {
    padding: 0.8rem;
  }

  .slide-summary {
    font-size: 0.9rem;
  }

  th,
  td {
    padding: 0.46rem 0.48rem;
  }

  pre {
    padding: 0.75rem;
  }

  code {
    font-size: 0.78rem;
  }

  footer {
    width: min(100% - 1rem, 1120px);
    margin-bottom: 1.5rem;
  }
}
