/* Text Refresh Features for Long Pages */
/* Reading enhancement controls, progress tracking, and navigation aids */

/* ========== READING PROGRESS INDICATOR ========== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(196, 126, 74, 0.1);
  z-index: 1000;
  pointer-events: none;
}

.reading-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-copper-gold), var(--color-hover-gold));
  width: 0%;
  transition: width 0.2s ease-out;
}

/* ========== FLOATING TABLE OF CONTENTS ========== */
.floating-toc {
  position: fixed;
  top: 50%;
  right: 2rem;
  transform: translateY(-50%);
  width: 240px;
  max-height: 60vh;
  background: var(--color-charcoal-card);
  border: 1px solid rgba(159, 125, 90, 0.2);
  border-radius: 8px;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-out;
  z-index: 100;
  overflow-y: auto;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.floating-toc.visible {
  opacity: 1;
  visibility: visible;
}

.floating-toc__header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-copper-gold);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(159, 125, 90, 0.2);
  padding-bottom: 0.5rem;
}

.floating-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.floating-toc__item {
  margin-bottom: 0.25rem;
}

.floating-toc__link {
  display: block;
  padding: 0.5rem 0;
  font-size: 0.8rem;
  color: var(--color-muted-cream);
  text-decoration: none;
  line-height: 1.3;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
  transition: all 0.2s ease-out;
  border-radius: 0 4px 4px 0;
}

.floating-toc__link:hover {
  color: var(--color-copper-gold);
  background: rgba(196, 126, 74, 0.1);
  border-left-color: var(--color-copper-gold);
}

.floating-toc__link.active {
  color: var(--color-copper-gold);
  background: rgba(196, 126, 74, 0.15);
  border-left-color: var(--color-copper-gold);
  font-weight: 500;
}

.floating-toc__link--h3 {
  padding-left: 1.25rem;
  font-size: 0.75rem;
  opacity: 0.8;
}

.floating-toc__link--h4 {
  padding-left: 1.75rem;
  font-size: 0.7rem;
  opacity: 0.7;
}

/* ========== TEXT ENHANCEMENT CONTROLS ========== */
.text-controls {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-out;
  z-index: 100;
}

.text-controls.visible {
  opacity: 1;
  visibility: visible;
}

.text-control {
  width: 44px;
  height: 44px;
  background: var(--color-charcoal-card);
  border: 1px solid rgba(159, 125, 90, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease-out;
  color: var(--color-muted-cream);
  font-size: 1.1rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.text-control:hover {
  background: var(--color-copper-gold);
  color: var(--color-deep-navy);
  border-color: var(--color-copper-gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196, 126, 74, 0.3);
}

.text-control.active {
  background: var(--color-copper-gold);
  color: var(--color-deep-navy);
  border-color: var(--color-copper-gold);
}

/* ========== SCROLL TO TOP ========== */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--color-charcoal-card);
  border: 1px solid rgba(159, 125, 90, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-out;
  z-index: 100;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  background: var(--color-copper-gold);
  color: var(--color-deep-navy);
  border-color: var(--color-copper-gold);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(196, 126, 74, 0.4);
}

.scroll-top::before {
  content: "↑";
  font-size: 1.25rem;
  font-weight: bold;
  color: inherit;
}

/* ========== TEXT ENHANCEMENT STATES ========== */
body.large-text .article__content {
  font-size: 1.25rem;
}

body.large-text .article__content h1 { font-size: 2.75rem; }
body.large-text .article__content h2 { font-size: 2.25rem; }
body.large-text .article__content h3 { font-size: 1.75rem; }

body.wide-spacing .article__content {
  line-height: 2;
}

body.wide-spacing .article__content p {
  margin-bottom: 2rem;
}

body.wide-spacing .article__content h1,
body.wide-spacing .article__content h2,
body.wide-spacing .article__content h3 {
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

body.high-contrast {
  --color-warm-ivory: #ffffff;
  --color-muted-cream: #e0e0e0;
  --color-deep-navy: #000000;
  --color-charcoal-card: #1a1a1a;
}

/* ========== READING FOCUS MODE ========== */
body.focus-mode .header,
body.focus-mode .breadcrumb,
body.focus-mode .page-hero,
body.focus-mode .article__footer,
body.focus-mode footer {
  opacity: 0.3;
  transition: opacity 0.3s ease-out;
}

body.focus-mode .header:hover,
body.focus-mode .breadcrumb:hover,
body.focus-mode .page-hero:hover,
body.focus-mode .article__footer:hover,
body.focus-mode footer:hover {
  opacity: 1;
}

/* ========== READING TIME ESTIMATE ========== */
.reading-time-remaining {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--color-charcoal-card);
  border: 1px solid rgba(159, 125, 90, 0.2);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--color-muted-cream);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-out;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.reading-time-remaining.visible {
  opacity: 1;
  visibility: visible;
}

.reading-time-remaining__text {
  font-family: var(--font-mono);
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */
@media (max-width: 1024px) {
  .floating-toc {
    right: 1rem;
    width: 200px;
  }
}

@media (max-width: 768px) {
  .floating-toc {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 40vh;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
  }

  .floating-toc.visible {
    transform: translateY(0);
  }

  .text-controls {
    bottom: 1rem;
    left: 1rem;
    gap: 0.25rem;
  }

  .text-control {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .scroll-top {
    bottom: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
  }

  .reading-time-remaining {
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }
}

/* ========== TABLE ENHANCEMENT FOR LONG TABLES ========== */
.enhanced-table-wrapper {
  position: relative;
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: 8px;
  border: 1px solid rgba(159, 125, 90, 0.2);
  background: var(--color-charcoal-card);
}

.enhanced-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.enhanced-table th,
.enhanced-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(159, 125, 90, 0.1);
}

.enhanced-table th {
  background: rgba(196, 126, 74, 0.1);
  color: var(--color-copper-gold);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 10;
}

.enhanced-table tr:hover {
  background: rgba(196, 126, 74, 0.05);
}

.enhanced-table td:first-child {
  font-weight: 500;
  color: var(--color-copper-gold);
}

/* Ranking table specific styling */
.ranking-table .rank-cell {
  font-weight: bold;
  color: var(--color-copper-gold);
  font-size: 1.1em;
  text-align: center;
  width: 60px;
}

.ranking-table .company-cell {
  font-weight: 600;
  max-width: 200px;
}

.ranking-table .score-cell {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9em;
  width: 80px;
}

.ranking-table .total-score-cell {
  font-weight: bold;
  color: var(--color-hover-gold);
  text-align: center;
  font-size: 1.1em;
  background: rgba(196, 126, 74, 0.1);
}

.ranking-table .score-high { color: #ff6b6b; }
.ranking-table .score-medium { color: #ffa726; }
.ranking-table .score-low { color: #66bb6a; }