:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #c45c26;
  --accent-dark: #9a4518;
  --egg-yellow: #f6c544;
  --egg-yellow-soft: #fdf3d3;
  --egg-yellow-deep: #e6a92b;
  --border: #e8dfd4;
  --shadow: 0 8px 32px rgba(26, 26, 26, 0.08);
  --radius: 12px;
  --max-width: 1100px;
  --wide-width: 1500px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img,
video {
  display: block;
}

a {
  color: var(--accent);
}

.container {
  width: min(var(--max-width), calc(100% - 2rem));
  margin-inline: auto;
  container-type: inline-size;
}

.container-wide {
  width: min(var(--wide-width), calc(100% - 2rem));
  margin-inline: auto;
  container-type: inline-size;
}

/* ---------- Shared media frame: uniform height, keep aspect, no padding ---------- */
.media-frame {
  background: transparent;
  border-radius: var(--radius);
  overflow: hidden;
  line-height: 0;
}

.media-frame img,
.media-frame video {
  width: auto;
  max-width: 100%;
  border-radius: var(--radius);
}

.media-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
}

.media-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.media-caption {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}

/* click-to-control videos */
video.click-to-control {
  cursor: pointer;
}

/* ---------- Academic paper header ---------- */
.paper-header {
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  border-bottom: 3px solid var(--egg-yellow);
  padding: 3.5rem 0 3rem;
  text-align: center;
}

.paper-title {
  margin: 0 auto 1rem;
  max-width: 900px;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.paper-authors {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  color: var(--text);
}

.paper-affiliation {
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.paper-links {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.paper-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--egg-yellow-soft);
  color: var(--accent-dark);
  border: 1px solid var(--egg-yellow);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.12s, background 0.12s, box-shadow 0.12s;
}

.paper-btn:hover {
  transform: translateY(-1px);
  background: var(--egg-yellow);
  box-shadow: var(--shadow);
}

.paper-btn.dark {
  background: #24292f;
  color: #fff;
  border-color: #24292f;
}

.paper-btn.dark:hover {
  background: #000;
}

.hero-video {
  margin: 0 auto;
  max-width: 960px;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-video video {
  width: 100%;
  max-width: 100%;
}

/* ---------- Sections ---------- */
section {
  padding: 3.5rem 0;
}

section:nth-of-type(even) {
  background: var(--surface);
}

.full-bleed {
  width: 100%;
}

.section-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  text-align: center;
}

.section-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin: 0.6rem auto 0;
  background: var(--egg-yellow);
  border-radius: 2px;
}

.section-subtitle {
  margin: 0 auto 2.5rem;
  max-width: 720px;
  text-align: center;
  color: var(--muted);
}

.section-lead {
  max-width: 820px;
  margin: 0 auto 2.5rem;
  color: var(--text);
}

.section-lead p {
  margin: 0 0 1rem;
}

/* ---------- Carousel (full-bleed, horizontal task rows) ---------- */
.carousel {
  position: relative;
  width: min(var(--wide-width), calc(100% - 5rem));
  margin: 0 auto;
}

.carousel-viewport {
  overflow: hidden;
  border-radius: var(--radius);
}

.carousel-track {
  display: flex;
  transition: transform 0.4s ease;
}

.carousel-slide {
  flex: 0 0 100%;
  padding: 1.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--egg-yellow);
  border-radius: var(--radius);
}

.slide-label {
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--egg-yellow-deep);
  font-weight: 700;
  margin: 0 0 1.5rem;
}

.task-block {
  margin-bottom: 2rem;
}

.task-block:last-child {
  margin-bottom: 0;
}

.task-block h3 {
  margin: 0 0 0.9rem;
  font-size: 1.2rem;
  text-align: center;
  color: var(--accent-dark);
}

/* Task videos: always side by side, uniform size (column width drives height) */
.task-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.task-row.two {
  grid-template-columns: repeat(2, calc((100% - 2rem) / 3));
  justify-content: center;
}

.task-row video {
  width: 100%;
  height: auto;
  background: transparent;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: 1px solid var(--egg-yellow);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  z-index: 2;
}

.carousel-btn:hover {
  background: var(--egg-yellow);
  color: #fff;
}

.carousel-btn.prev {
  left: -1.6rem;
}

.carousel-btn.next {
  right: -1.6rem;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.carousel-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: none;
  background: var(--border);
  cursor: pointer;
  padding: 0;
}

.carousel-dot.active {
  background: var(--egg-yellow);
}

/* ---------- Grasps (larger cards, up to 2 per row) ---------- */
.grasps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 2rem;
}

.grasp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.grasp-media {
  border-radius: 0;
}

.grasp-media img {
  width: 100%;
  border-radius: 0;
}

.grasp-card h3 {
  margin: 1.1rem 1.25rem 0.5rem;
  font-size: 1.25rem;
  color: var(--accent-dark);
}

.grasp-card h3::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--egg-yellow);
  vertical-align: middle;
}

.grasp-card p {
  margin: 0 1.25rem 1.4rem;
  font-size: 0.98rem;
  color: var(--muted);
}

/* ---------- Force control ---------- */
.section-lead.closing {
  margin-top: 2rem;
  margin-bottom: 0;
}

.force-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--egg-yellow);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.force-media {
  border-radius: 0;
}

.force-media img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 0;
}

.info-card h3 {
  margin: 1.1rem 1.4rem 0.5rem;
  font-size: 1.15rem;
  color: var(--accent-dark);
}

.info-card p {
  margin: 0 1.4rem 1.3rem;
  color: var(--muted);
}

/* ---------- Hardware ---------- */
.hardware-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  margin-top: 1rem;
}

.hardware-media img {
  width: 100%;
  box-shadow: var(--shadow);
}

.spec-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.spec-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.spec-key {
  display: inline-block;
  min-width: 130px;
  font-weight: 700;
  color: var(--accent-dark);
}

.spec-key::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 0.5rem;
  border-radius: 2px;
  background: var(--egg-yellow);
  vertical-align: middle;
}

/* ---------- Simulation ---------- */
.sim-row {
  flex-wrap: nowrap;
}

.sim-media img,
.sim-media video {
  height: clamp(180px, 26cqw, 360px);
  box-shadow: var(--shadow);
}

/* ---------- Taste ---------- */
.taste-row {
  flex-wrap: nowrap;
}

.taste-media video,
.taste-media img {
  height: clamp(200px, 34cqw, 380px);
  box-shadow: var(--shadow);
}

.subsection-title {
  text-align: center;
  font-size: 1.4rem;
  margin: 3rem 0 1.5rem;
  color: var(--accent-dark);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin: 0 auto;
}

.testimonial {
  margin: 0;
  padding: 1.5rem 1.4rem;
  background: var(--egg-yellow-soft);
  border-left: 4px solid var(--egg-yellow);
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.testimonial span {
  display: block;
  white-space: nowrap;
}

/* ---------- Demo ---------- */
.demo-top,
.demo-team {
  flex-wrap: nowrap;
}

.demo-team {
  margin-top: 1rem;
}

.demo-top .demo-media video,
.demo-top .demo-media img {
  height: clamp(280px, 40cqw, 520px);
  box-shadow: var(--shadow);
}

.demo-team .demo-media img {
  height: clamp(240px, 34cqw, 480px);
  box-shadow: var(--shadow);
}

/* ---------- Challenges ---------- */
.challenges-placeholder {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem;
  background: var(--egg-yellow-soft);
  border: 2px dashed var(--egg-yellow);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}

/* ---------- Bloopers ---------- */
.blooper-row {
  flex-wrap: nowrap;
}

.blooper-media video {
  height: clamp(180px, 26cqw, 340px);
  box-shadow: var(--shadow);
}

/* ---------- Footer ---------- */
footer {
  padding: 1rem 0 2rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text);
  border-top: 3px solid var(--egg-yellow);
}

.footer-title {
  margin: 0 0 1rem;
  font-size: 1.6rem;
  color: var(--accent-dark);
}

.footer-title::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  margin: 0.5rem auto 0;
  background: var(--egg-yellow);
  border-radius: 2px;
}

footer p {
  margin: 0;
}

.footer-sub {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hardware-grid {
    grid-template-columns: 1fr;
  }

  .grasps-grid {
    grid-template-columns: 1fr;
  }

  .carousel {
    width: calc(100% - 3.5rem);
  }

  .carousel-btn.prev {
    left: -1rem;
  }

  .carousel-btn.next {
    right: -1rem;
  }

  .testimonials-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* On phones, let the always-one-line rows stack so media stay legible. */
@media (max-width: 760px) {
  .task-row,
  .task-row.two {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .sim-row,
  .taste-row,
  .demo-top,
  .demo-team,
  .blooper-row {
    flex-wrap: wrap;
  }

  .media-item {
    width: 100%;
  }

  .sim-media img,
  .sim-media video,
  .taste-media video,
  .taste-media img,
  .demo-top .demo-media img,
  .demo-top .demo-media video,
  .demo-team .demo-media img,
  .blooper-media video {
    height: auto;
    width: 100%;
    max-width: 480px;
  }
}

@media (max-width: 560px) {
  .testimonials-grid {
    grid-template-columns: 1fr;
  }
}
