/* ==========================================================================
   Stock header card (public stock page)
   Mirrors the app's SingleStockCard / CompanyInfoSection:
   white area (360° circle + company info) on top, dark brown strip with the
   five sub-ranks below. No JavaScript is needed for the 360° circle: the
   arc is drawn with stroke-dasharray + pathLength="100" straight from the
   {{CurrentRank360}} placeholder.
   ========================================================================== */

.stock-top {
  padding: 24px 0 0;
  font-family: var(--font-family, "Inter", sans-serif);
}

.sh-card {
  border: 1px solid var(--color-border, #E0DAD1);
  border-radius: 12px;
  background: #fff;
}

/* ---------- White main area ---------- */
.sh-main {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 24px 24px 20px;
}

/* ---------- 360° circle ---------- */
.sh-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.sh-circle {
  position: relative;
  width: 132px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sh-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.sh-circle__track {
  fill: none;
  stroke: #D1D5DB;
  stroke-width: 1;
}

.sh-circle__progress {
  fill: none;
  stroke: var(--color-rank-grey, #DDDDDD);
  stroke-width: 2;
}

.sh-circle__progress.dark_green { stroke: var(--color-rank-green-dark, #339933); }
.sh-circle__progress.light_green { stroke: var(--color-rank-green-light, #79B758); }
.sh-circle__progress.yellow { stroke: var(--color-rank-yellow, #FFC239); }
.sh-circle__progress.red { stroke: var(--color-rank-red, #E71313); }

.sh-circle__number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  color: #1E1E1E;
}

.sh-score__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
  color: #3F3B37;
  white-space: nowrap;
}

.sh-score__label img {
  width: 20px;
  height: auto;
  opacity: 0.6;
}

/* ---------- Company info ---------- */
.sh-info {
  min-width: 0;
}

.sh-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.sh-flag {
  width: 32px;
  height: 22px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 2px;
}

.sh-name {
  margin: 0;
  font-family: var(--font-family, "Inter", sans-serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  color: #1E1E1E;
}

.sh-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid var(--color-border, #E0DAD1);
  border-radius: 999px;
  background: #fff;
  font-family: var(--font-family, "Inter", sans-serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: #0F0F0F;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.sh-pill:hover {
  background: #F9F2EC;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.sh-pill img {
  width: 16px;
  height: 16px;
}

.sh-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 6px;
}

.sh-ticker {
  padding: 4px 8px;
  border-radius: 6px;
  background: #F0EDE9;
  font-size: 14px;
  font-weight: 500;
  color: #472101;
}

.sh-isin {
  font-size: 14px;
  color: rgba(63, 59, 55, 0.6);
}

.sh-meta a {
  font-size: 14px;
  font-weight: 500;
  color: #EA580C;
  text-decoration: none;
}

.sh-meta a:hover {
  text-decoration: underline;
}

.sh-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 8px;
  font-size: 14px;
  color: rgba(63, 59, 55, 0.6);
}

.sh-ranks-line {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin-top: 10px;
  font-size: 14px;
  color: rgba(63, 59, 55, 0.6);
}

.sh-ranks-line strong {
  font-weight: 600;
}

.sh-desc {
  margin-top: 8px;
}

.sh-desc p,
.sh-desc .expandable-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(63, 59, 55, 0.7);
}

.sh-desc .more-link {
  font-size: 14px;
  color: rgba(63, 59, 55, 0.5);
  text-decoration: underline;
}

.sh-desc .more-link:hover {
  color: #3F3B37;
}

.sh-desc + .sh-desc {
  margin-top: 6px;
}

.sh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

/* chips come from the {{(partOfIndex)}} placeholder, whatever markup it renders */
.sh-chips a,
.sh-chips .index-badge,
.sh-chips span {
  padding: 2px 8px;
  border-radius: 4px;
  background: #F0EDE9;
  font-size: 12px;
  color: #653004;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.sh-chips a:hover,
.sh-chips .index-badge:hover {
  background: #E8E0D8;
}

.sh-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* ---------- "Read analysis" pop-up (native <details>, no framework) ---------- */
.sh-pop {
  position: relative;
}

.sh-pop > summary {
  list-style: none;
  cursor: pointer;
}

.sh-pop > summary::-webkit-details-marker {
  display: none;
}

.sh-pop > summary i,
.sh-pop > summary svg {
  width: 16px;
  height: 16px;
}

.sh-pop[open] > summary {
  background: #F9F2EC;
}

.sh-pop__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  width: min(440px, calc(100vw - 64px));
  max-height: 340px;
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--color-border, #E0DAD1);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.sh-pop__title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #0F0F0F;
}

.sh-pop__text {
  font-size: 14px;
  line-height: 1.6;
  color: #3F3B37;
}

.sh-pop__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 20px;
  border-radius: 999px;
  background: var(--color-button-orange, #D13D14);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.sh-pop__cta:hover {
  background: rgba(209, 61, 20, 0.85);
}

.sh-pop__cta i,
.sh-pop__cta svg {
  width: 16px;
  height: 16px;
}

/* ---------- Dark footer with the five sub-ranks ---------- */
.sh-ranks {
  position: relative;
  overflow: hidden;
  border-radius: 0 0 11px 11px;
  border-top: 1px solid #5A3010;
  background: linear-gradient(180deg, #472101 0%, #653004 100%);
  color: #fff;
}

.sh-ranks__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.sh-rank {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 16px 16px;
}

.sh-rank__head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
}

.sh-rank__head svg,
.sh-rank__head [data-lucide] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.8);
}

.sh-rank__body {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.sh-rank__value {
  width: 32px;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.sh-rank__bar {
  position: relative;
  flex: 1;
  height: 12px;
  margin-top: 1px;
  display: flex;
  align-items: center;
}

.sh-rank__bar::before {
  content: "";
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.sh-rank__bar span {
  position: absolute;
  left: 0;
  height: 6px;
}

/* illustrative fills; the real values are not shipped to the page */
.sh-rank__bar .is-dark-green { background: #339933; }
.sh-rank__bar .is-light-green { background: #79B758; }
.sh-rank__bar .is-yellow { background: #F7D000; }
.sh-rank__bar .is-red { background: #E71313; }

.sh-ranks__lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
}

.sh-ranks__lock .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 999px;
  background: var(--color-button-orange, #D13D14);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.sh-ranks__lock .btn:hover {
  background: rgba(209, 61, 20, 0.8);
}

.sh-ranks__lock .btn i,
.sh-ranks__lock .btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- Note under the card ---------- */
.stock-top .analysis-date {
  margin: 8px 0 32px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(63, 59, 55, 0.6);
}

.stock-top .analysis-date strong {
  font-weight: 600;
  color: rgba(63, 59, 55, 0.8);
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .sh-main {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 16px;
    padding: 20px 16px 16px;
  }

  .sh-circle {
    width: 110px;
    height: 110px;
  }

  .sh-circle__number {
    font-size: 36px;
  }

  .sh-name {
    font-size: 24px;
  }

  /* only the watchlist pill next to the name collapses to an icon (as in the app) */
  .sh-name-row .sh-pill span {
    display: none;
  }

  .sh-name-row .sh-pill {
    padding: 6px 10px;
  }

  /* value on top, bar, label below (as in the app on small screens) */
  .sh-rank {
    flex-direction: column-reverse;
    padding: 8px 4px 12px;
    align-items: center;
    gap: 4px;
  }

  .sh-rank__head {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
  }

  .sh-rank__head svg,
  .sh-rank__head [data-lucide] {
    display: none;
  }

  .sh-rank__body {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
  }

  .sh-rank__bar {
    width: 80%;
  }

  .sh-rank__value {
    width: auto;
    font-size: 14px;
  }

  .sh-rank__bar {
    width: 80%;
    flex: none;
  }
}

@media (max-width: 480px) {
  .sh-main {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .sh-info {
    width: 100%;
  }
}
