:root {
  --bg: #eef3f7;
  --bg-accent: #d7e3ee;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-dark: #0f2233;
  --border: rgba(15, 34, 51, 0.12);
  --border-strong: rgba(15, 34, 51, 0.2);
  --text: #22384a;
  --text-soft: #5f7485;
  --heading: #10283d;
  --primary: #0a5cab;
  --primary-deep: #083b76;
  --accent: #f28c28;
  --accent-soft: rgba(242, 140, 40, 0.12);
  --shadow: 0 18px 40px rgba(18, 39, 61, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --content-width: 1240px;
}

html,
body {
  margin: 0;
  padding: 0;
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(242, 140, 40, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(10, 92, 171, 0.14), transparent 24%),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(10, 92, 171, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 92, 171, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 75%);
}

.content {
  width: min(1240px, calc(100vw - 392px));
  max-width: none;
  margin-left: 350px;
  margin-right: 24px;
  padding: 42px 24px 88px;
  position: relative;
  z-index: 1;
}

.page-shell {
  max-width: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.page-sidebar {
  position: fixed !important;
  left: 18px;
  top: 18px;
  width: 300px;
  height: calc(100vh - 36px);
  z-index: 999;

  overflow-y: auto;
 
  overflow-x: hidden;

  scroll-behavior: smooth;
}

.sidebar-inner {
  height: auto;
  padding: 18px 0 24px;
}

.sidebar-eyebrow {
  margin: 0 0 12px 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.hero-panel {
  display: block;
  padding: 24px 28px;
  margin-bottom: 26px;
  border-radius: 22px;
  border: 1px solid rgba(10, 92, 171, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 253, 0.95)),
    var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
}

.hero-panel::after {
  display: none;
}

.hero-eyebrow {
  margin: 0 0 14px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
}

h1 {
  margin: 0;
  color: var(--heading);
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: 0.01em;
}

.hero-summary {
  margin: 14px 0 0;
  max-width: 920px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-soft);
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-facts span,
.quick-links a {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.hero-facts span {
  color: var(--primary-deep);
  background: rgba(10, 92, 171, 0.08);
  border: 1px solid rgba(10, 92, 171, 0.12);
}

.team-member-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 20px;
}

.team-member-wrapper team-member {
  flex: 1 1 280px;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 30px;
}

.quick-links a {
  color: var(--primary-deep);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(10, 92, 171, 0.15);
  box-shadow: 0 8px 22px rgba(18, 39, 61, 0.05);
}

.quick-links a:hover {
  background: #fff;
  transform: translateY(-1px);
}

.table-of-content,
#abstract,
#introduction,
#literature-review,
#section-3,
#limitations,
#next-steps-sem2,
#additional-design-elements,
#manufacturing-assembly,
#testing,
#simulation,
#conclusion,
#references,
#appendix {
  position: relative;
  margin: 0 0 28px;
  padding: 28px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 253, 0.93)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.table-of-content-sidebar {
  height: auto;
  margin-bottom: 0;
  padding: 20px 18px;
  overflow: visible;
}

.table-of-content-sidebar h2 {
  margin-bottom: 14px;
  font-size: 1.45rem;
}

.table-of-content::before,
#abstract::before,
#introduction::before,
#literature-review::before,
#section-3::before,
#limitations::before,
#next-steps-sem2::before,
#additional-design-elements::before,
#manufacturing-assembly::before,
#testing::before,
#simulation::before,
#conclusion::before,
#references::before,
#appendix::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--accent), var(--primary), #4ba3b0);
}

sl-divider {
  display: none;
}

h2,
h3,
h4,
h5,
h6 {
  color: var(--heading);
}

h2 {
  margin: 0 0 20px;
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
  font-size: clamp(2rem, 3vw, 3rem);
  letter-spacing: 0.01em;
  color: var(--primary);
}

h3 {
  margin: 30px 0 14px;
  padding-left: 16px;
  border-left: 4px solid var(--accent);
  font-size: 1.45rem;
  line-height: 1.25;
  color: var(--primary-deep);
}

h4,
h5,
h6 {
  margin: 22px 0 10px;
}

p,
li {
  font-size: 1.02rem;
  line-height: 1.8;
}

p {
  margin: 0 0 16px;
  text-align: justify;
}

ul,
ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

li + li {
  margin-top: 8px;
}

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

strong {
  color: var(--heading);
}

[id] {
  scroll-margin-top: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 34, 51, 0.05);
}

th,
td {
  border: 1px solid rgba(16, 40, 61, 0.1) !important;
  padding: 10px 12px !important;
  vertical-align: top;
}

thead tr {
  background: linear-gradient(180deg, #edf4fa, #e5eef7) !important;
}

th {
  color: var(--primary-deep);
  font-weight: 800;
}

tbody tr:nth-child(even) {
  background: rgba(239, 244, 249, 0.52);
}

image-component,
model-viewer,
video-component,
iframe,
canvas,
img {
  display: block;
}

image-component {
  margin: 18px 0 16px;
}

image-component::part(base) {
  border-radius: 18px;
}

sub,
p[style*="font-style:italic"] {
  color: var(--text-soft);
}

code {
  padding: 0.14rem 0.38rem;
  border-radius: 8px;
  background: rgba(10, 92, 171, 0.08);
  color: var(--primary-deep);
}

.table-of-content sl-tree {
  padding: 14px 16px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbfd, #f1f6fb);
  border: 1px solid rgba(10, 92, 171, 0.1);
  max-height: none;
  overflow: visible;
}

.table-of-content a {
  text-decoration: none;
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.table-of-content a:hover {
  text-decoration: underline;
}

.page-sidebar a.active {
  display: inline-block;
  padding: 3px 8px;
  margin-left: -8px;
  border-radius: 10px;
  color: var(--primary-deep);
  background: rgba(10, 92, 171, 0.1);
  box-shadow: inset 0 0 0 1px rgba(10, 92, 171, 0.14);
  text-decoration: none;
}

.scroll-to-top {
  position: fixed;
  bottom: 30px; /* Adjust distance from bottom */
  right: 30px;  /* Adjust distance from right side */
  z-index: 9999 !important; /* This forces it above ALL other panels */
  display: flex;
}

.scroll-to-top::part(base) {
  box-shadow: 0 14px 30px rgba(10, 92, 171, 0.28);
}

.chart-card {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 20px 8px;
  border-radius: 18px;
  border: 1px solid rgba(10, 92, 171, 0.12);
  background: linear-gradient(180deg, #ffffff, #f8fbfd);
  box-shadow: 0 10px 24px rgba(15, 34, 51, 0.05);
}

.report-chart {
  width: 100%;
  height: 560px;
}

.appendix-accordion {
  display: grid;
  gap: 14px;
}

.appendix-accordion sl-details::part(base) {
  border-radius: 18px;
  border: 1px solid rgba(10, 92, 171, 0.14);
  background: linear-gradient(180deg, #fbfdff, #f3f7fb);
  box-shadow: 0 10px 24px rgba(15, 34, 51, 0.05);
  overflow: hidden;
}

.appendix-accordion sl-details::part(summary) {
  padding: 16px 18px;
  font-weight: 800;
  color: var(--primary-deep);
  font-size: 1rem;
}

.appendix-accordion sl-details::part(content) {
  padding: 0;
}

.appendix-panel {
  padding: 4px 18px 18px;
}

@media (max-width: 1080px) {
  .page-sidebar {
    display: none;
  }

  .content {
    width: auto;
    margin-left: 0;
    margin-right: 0;
    padding: 28px 18px 72px;
  }
}

@media (max-width: 820px) {
  .table-of-content,
  #abstract,
  #introduction,
  #literature-review,
  #section-3,
  #limitations,
  #next-steps-sem2,
  #additional-design-elements,
  #manufacturing-assembly,
  #testing,
  #simulation,
  #conclusion,
  #references,
  #appendix {
    padding: 22px 18px;
    border-radius: 20px;
  }

  .hero-panel {
    padding: 24px 20px;
    border-radius: 22px;
  }

  h2 {
    font-size: 2.1rem;
  }

  #conclusion > div {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  .scroll-to-top {
    bottom: 16px;
    right: 16px;
    transform: scale(0.85); /* Makes it slightly smaller on phones */
  }
  body {
    font-size: 16px;
  }

  .quick-links {
    gap: 8px;
  }

  .quick-links a,
  .hero-facts span {
    width: 100%;
    text-align: center;
  }

  p,
  li {
    font-size: 0.98rem;
  }
}
