html,
body {
  width: 100%;
  max-width: 100vw;
}

html {
  background: #eef2f5;
  font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 1em;
  line-height: 1.625em;
  color: #1a1c1c;
}

* {
  text-rendering: geometricPrecision;
}

body {
  margin: 0 auto;
}

h1 {
  color: rgb(26, 28, 28);
  font-family: Lato, "Apple Symbols", BlinkMacSystemFont, "segoe ui",
    "avenir next", avenir, "helvetica neue", helvetica, ubuntu, roboto, noto,
    arial, sans-serif;
  font-weight: 900;
  margin: 0px;
  overflow-wrap: normal;
  hyphens: none;
  font-size: 26px;
  line-height: 1.25;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

h2 {
  color: rgb(26, 28, 28);
  font-family: Lato, "Apple Symbols", BlinkMacSystemFont, "segoe ui",
    "avenir next", avenir, "helvetica neue", helvetica, ubuntu, roboto, noto,
    arial, sans-serif;
  font-weight: 900;
  margin: 0px;
  overflow-wrap: normal;
  hyphens: none;
  font-size: 24px;
  line-height: 1.33333;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

h3 {
  color: rgb(26, 28, 28);
  font-family: Lato, "Apple Symbols", BlinkMacSystemFont, "segoe ui",
    "avenir next", avenir, "helvetica neue", helvetica, ubuntu, roboto, noto,
    arial, sans-serif;
  font-weight: 900;
  margin: 0px;
  overflow-wrap: normal;
  hyphens: none;
  font-size: 20px;
  line-height: 1.33333;
}

h4 {
  color: rgb(26, 28, 28);
  font-family: Lato, "Apple Symbols", BlinkMacSystemFont, "segoe ui",
    "avenir next", avenir, "helvetica neue", helvetica, ubuntu, roboto, noto,
    arial, sans-serif;
  font-weight: 900;
  margin: 0px;
  overflow-wrap: normal;
  hyphens: none;
  font-size: 18px;
  line-height: 1.42857;
}

h5 {
  color: rgb(26, 28, 28);
  font-family: Lato, "Apple Symbols", BlinkMacSystemFont, "segoe ui",
    "avenir next", avenir, "helvetica neue", helvetica, ubuntu, roboto, noto,
    arial, sans-serif;
  font-weight: 900;
  margin: 0px;
  overflow-wrap: normal;
  hyphens: none;
  font-size: 16px;
  line-height: 1.5;
}

h6 {
  color: rgb(96, 117, 133);
  font-family: Lato, "Apple Symbols", BlinkMacSystemFont, "segoe ui",
    "avenir next", avenir, "helvetica neue", helvetica, ubuntu, roboto, noto,
    arial, sans-serif;
  font-weight: 900;
  margin: 0px;
  overflow-wrap: normal;
  hyphens: none;
  font-size: 12px;
  line-height: 1.33333;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

a {
  color: #047a88;
}

u {
  text-decoration: underline;
  text-decoration-color: #a3b2bd;
}

li p {
  margin: 0.25rem;
}

.page-container.home {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.home h1 {
  margin-top: 0;
}

.home > p {
  margin: 0;
}

.page-header a {
  display: inline-block;
  border: 0px;
  margin: 0px;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.33333;
  font-weight: 700;
  cursor: pointer;
  padding: 12px 12px 12px 0;
  color: rgb(64, 81, 94);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: fit-content;
}

.page-header a:hover {
  text-decoration: underline;
}

.page-header h1 {
  margin-top: 0.5rem;
}

.page-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem 2rem 0 2rem;
}

section.category {
  width: 100%;
}

.page-content {
  display: flex;
  gap: 2rem;
  position: relative;
  width: 100%;
}

.article-body {
  flex: 1 1 0%;
  min-width: 0;
  width: 0;
}

.article-body > .article-section {
  margin: 1rem 0;
  background: #fff;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
}

.callout-grey {
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e5e9;
  flex: 0 0 100%;
}

.callout-grey .title {
  font-size: 1.5rem;
  line-height: 100%;
  font-weight: 700;
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.callout-grey .subtitle {
  font-size: 1rem;
  font-weight: 400;
  margin: 0;
}

.blueBox {
  border: 1px solid rgba(163, 178, 189, 0.3);
  border-radius: 4px;
  padding: 16px;
  background-color: rgb(231, 239, 254);
  margin-bottom: 1rem;
}

.blueBox > * {
  margin: 0;
  font-weight: 400;
  color: rgb(28, 66, 125);
  font-size: 14px;
  line-height: 1.42857;
}

.blueBox a {
  text-decoration-line: underline;
  color: rgb(28, 66, 125);
}

.grayBox {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-direction: row;
  gap: 0 3rem;
}

.grayBox .contributor {
  flex: 0 0 44%;
}

.grayBox img {
  max-width: 115px;
}

.grayBox .contributor-team p {
  margin: 0;
}

.curator-info {
  overflow: hidden;
}

.curator-avatar {
  float: left;
  margin-right: 1rem;
  max-width: 145px;
}

.curator-details p {
  margin: 0;
}

.ref div > a {
  color: rgb(26, 28, 28);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.ref div > a:hover {
  text-decoration: underline;
}

section[id*="videos"],
section[id*="images"],
section[id*="pictures"] {
  display: flex;
  flex-direction: row;
  gap: 1rem 3rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

section[id*="videos"] .article-section,
section[id*="images"] .article-section,
section[id*="pictures"] .article-section {
  flex: 0 0 46%;
  margin: 1rem 0;
}

section[id*="videos"] .ref,
section[id*="images"] .ref,
section[id*="pictures"] .ref {
  gap: 1.5rem;
  justify-content: flex-end;
  flex-direction: row-reverse;
  padding: 0;
  padding-bottom: 1rem;
  height: 100%;
}

section[id*="videos"] .ref div > a,
section[id*="images"] .ref div > a,
section[id*="pictures"] .ref div > a {
  font-size: 1rem;
}

section[id*="videos"] .ref div > p,
section[id*="images"] .ref div > p,
section[id*="pictures"] .ref div > p {
  display: none;
}

section[id*="videos"] .ref img,
section[id*="images"] .ref img,
section[id*="pictures"] .ref img {
  width: 130px;
  aspect-ratio: auto 130 / 88;
  height: 88px;
  object-fit: cover;
}

section[id*="videos"] > p,
section[id*="images"] > p,
section[id*="pictures"] > p,
section[id*="reviews"] > p,
section[id*="research"] > p,
section[id*="additional-resources"] > p,
section[id*="patient-and-family-resources"] > p,
section[id*="fast-facts"] > p,
section[id*="resources-for-providers"] > p,
section[id*="guidelines"] > p {
  display: none;
}

section[id*="videos"] > *:last-child .ref,
section[id*="images"] > *:last-child .ref,
section[id*="pictures"] > *:last-child .ref,
section[id*="reviews"] > *:last-child .ref,
section[id*="research"] > *:last-child .ref,
section[id*="additional-resources"] > *:last-child .ref,
section[id*="patient-and-family-resources"] > *:last-child .ref,
section[id*="fast-facts"] > *:last-child .ref,
section[id*="resources-for-providers"] > *:last-child .ref,
section[id*="guidelines"] > *:last-child .ref {
  border-bottom: none;
  padding-bottom: 0;
}

section[id*="videos"] .ref a::before {
  content: "video in clinical medicine";
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #047a88;
  display: block;
  line-height: 1.5;
}

section[id*="images"] .ref a::before {
  content: "image in clinical medicine";
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #047a88;
  line-height: 1.5;
}

subcategory-list {
  flex: 0 0 27%;
  position: sticky;
  top: 1.5rem;
  z-index: 100;
  height: fit-content;
}

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

figure i {
  font-size: 0.835rem;
}

.table-container {
  position: relative;
  width: 100%;
  overflow-x: auto;
  margin: 0 -1.5rem;
  padding: 0 1.5rem;
}

table {
  border-left: 1px solid #e0e6eb;
  border-spacing: 0;
  border-top: 1px solid #e0e6eb;
  text-align: left;
  border-radius: 4px;
  font-size: 0.875rem;
  line-height: 1.5em;
  margin-bottom: 1rem;
}

.table-caption {
  margin-bottom: 0.5rem;
}

table th {
  background-color: #f5f7f9;
  border-bottom: 1px solid #e0e6eb;
  border-right: 1px solid #e0e6eb;
  padding: 8px 12px;
}

table td {
  border-bottom: 1px solid #e0e6eb;
  border-right: 1px solid #e0e6eb;
  padding: 8px 12px;
}

.amboss-study-plans {
  background: #e7f6f8;
  border: 1px solid #cbdadc;
  padding: 1rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-content: center;
  flex-wrap: wrap;
}

.amboss-study-plans .title {
  font-size: 1.5rem;
  line-height: 100%;
  font-weight: 700;
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.amboss-study-plans .subtitle {
  font-size: 1rem;
  font-weight: 400;
  margin: 0;
}

button {
  display: inline-block;
  border: 0px;
  margin: 0px;
  text-transform: none;
  text-decoration: none;
  border-radius: 4px;
  font-family: Lato, "Apple Symbols", BlinkMacSystemFont, "segoe ui",
    "avenir next", avenir, "helvetica neue", helvetica, ubuntu, roboto, noto,
    arial, sans-serif;
  font-size: 14px;
  line-height: 1.14286;
  font-weight: 700;
  cursor: pointer;
  padding: 12px 24px;
  background-color: rgb(4, 122, 136);
  color: rgb(255, 255, 255);
}

.ref {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
  border-bottom: 1px solid #e2e5e9;
  padding: 1rem 0;
  justify-content: space-between;
}

.ref > div {
  flex: 0 60%;
}

.ref > img {
  max-width: 256px;
  width: 100%;
}

[id] {
  scroll-margin-top: 1rem;
}

footer {
  display: flex;
  flex-direction: row;
  align-content: center;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  max-width: 1440px;
  margin: 0 auto;
}

.footer-links a {
  margin-left: 1rem;
}

/* Mobile devices */
@media screen and (max-width: 992px) {
  .page-content {
    flex-direction: column;
  }

  .article-body {
    width: 100%;
  }

  subcategory-list {
    position: static;
    width: 100%;
    flex: none;
  }

  section[id*="videos"] .article-section,
  section[id*="images"] .article-section,
  section[id*="pictures"] .article-section {
    flex: 1 1 100%;
  }

  .page-container {
    padding: 1rem;
  }

  img {
    max-width: 100%;
  }

  .ref {
    flex-direction: column;
    gap: 1rem;
  }

  .ref > div {
    flex: 1 1 100%;
  }

  .ref > img {
    max-width: 100%;
  }

  footer {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .footer-links a {
    margin: 0.5rem;
    display: inline-block;
  }

  table {
    display: block;
    overflow-x: auto;
  }

  .category h2 {
    display: none;
  }

  .grayBox {
    flex-direction: column;
    gap: 1rem;
  }

  .grayBox .contributor {
    flex: 1 1 100%;
  }

  .article-body {
    width: 100%;
    max-width: 100%;
  }
}

/* Tablets */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .page-container {
    padding: 1.5rem;
  }

  section[id*="videos"] .article-section,
  section[id*="images"] .article-section,
  section[id*="pictures"] .article-section {
    flex: 0 0 45%;
  }
}

/* Responsive styles for categories */
.home .category-container {
  display: flex;
  flex-direction: column;
  margin-top: 0;
  width: 100%;
}

@media (max-width: 992px) {
  /* Tab styles */
  .tabs {
    display: flex;
    border-bottom: 1px solid #e2e5e9;
    width: 100%;
    margin-bottom: 1rem;
  }

  .tab {
    flex: 0 1 auto;
    padding: 1rem;
    text-align: center;
    background: none;
    cursor: pointer;
    border: none;
    color: #047a88;
    font-weight: 700;
    position: relative;
    transition: all 0.3s ease;
    font-size: 1rem;
    width: 100%;
  }

  .tab.active {
    color: #047a88;
    background: none;
  }

  .tab.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #047a88;
  }

  .tab:hover {
    background-color: rgba(4, 122, 136, 0.05);
  }

  /* Hide inactive category on mobile */
  .category {
    display: none;
  }

  .category.active {
    display: block;
  }
}

#scrollToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #fff;
  color: 000;
  width: 56px;
  height: 56px;
  border-radius: 100%;
  border: 1px solid lightgray;
  display: ruby-text;
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  z-index: 1000;
  transition: opacity 0.3s;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

#scrollToTop:hover {
  opacity: 1;
}

/* Hide on desktop */
@media (min-width: 992px) {
  #scrollToTop {
    display: none !important;
  }
}

/* Add hover effect for links containing images */
a:has(img)::after {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='118' height='20' viewBox='0 0 118 20'%3E%3Ctext x='0' y='15' fill='white' font-size='14px' font-weight='bold' font-family='inherit'%3EOpen in new tab %E2%86%97%3C/text%3E%3C/svg%3E");
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 118px;
  height: 20px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

a:has(img) {
  position: relative;
  display: block;
  width: 50%;
}

a:has(img):hover::after {
  opacity: 1;
}

/* Add dark overlay on hover */
a:has(img):hover::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
}

/* CATEGORY LIST */

ul.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  width: 100%;
  border-radius: 0.5rem;
  overflow: hidden;
}

.category-list li {
  margin: 0;
  background: #fff;
  display: block;
  overflow: hidden;
}

.category-list a {
  padding: 1rem;
  text-decoration: none;
  color: #1a1c1c;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  background: #fff;
  height: 100%;
  box-sizing: border-box;
}

.category-list a:hover {
  background: #f8f9fa;
}

.category-list li:last-child,
.pediatric .category-list li:nth-last-child(3) {
  border-bottom-right-radius: 0.5rem;
}

svg.rotation-icon[name="Surgery"] path {
  fill: #047a88;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  ul.category-list {
    grid-template-columns: repeat(3, 1fr);
  }
  .adult .category-list li:nth-last-child(3),
  .pediatric .category-list li:nth-last-child(2) {
    border-bottom-right-radius: 0.5rem;
  }

  .pediatric .category-list li:nth-last-child(3) {
    border-bottom-right-radius: 0;
  }
}

@media (max-width: 992px) {
  ul.category-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .pediatric .category-list li:nth-last-child(2) {
    border-bottom-right-radius: 0;
  }
}

@media (max-width: 480px) {
  ul.category-list {
    grid-template-columns: 1fr;
  }
}

/* Tablets and larger screens */
@media screen and (min-width: 769px) {
  .article-body {
    flex: 1 1 auto;
    width: auto;
  }

  subcategory-list {
    flex: 0 0 320px;
  }
}
