:root {
  /* colors */
  --lavender: #a6a6e6;
  --indigo: #39355a;
  --purple: #b06cfa;
  --blur-bg: rgba(176,108,250,0.08);
  --blue: #6a82fb;

  --black: #111;
  --dark-grey: #222;
  --white: #fff;
  --red: #d32f2f;

  --light-grey: #c3baba;

  /* Effects */
  --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

body {
  font-family: "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at center, #f8f9fa 0%, #F2E4FD 100%);

  color: var(--dark-grey);
}

h1 {
  text-align: center;
  padding: 30px 20px 10px;
  font-size: 2.2rem;
  color: var(--purple);
}

h2 {
  text-align: center;
  font-size: 1.8rem;
  color: var(--purple);
}

p {
  text-align: center;
  font-size: 1.05rem;
  color: var(--dark-grey);
  max-width: 900px;
  margin: 0 0 20px;
}

section {
  padding: 60px 20px;
}
/* Chart Container Styles - Note: Other Chart colors are renderd directly in the js*/
.chart-container {
  background: white;
  margin: 30px auto;
  padding: 20px;
  border-radius: 16px;
  box-shadow: var(--box-shadow);
  width: 90%;
  max-width: 1200px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}
/*  Age interactions through bar styles*/
.age-interaction {
  margin: 30px auto;
  text-align: center;
  padding: 20px;
  border-radius: 12px;
  backdrop-filter: blur(5px);
  max-width: 500px;
  width: 90%;
  background: var(--blur-bg);
  color: var(--purple);
  border: .5px solid var(--purple);
}

.age-interaction label {
  font-size: 1.2em;
  color: white;
  margin-bottom: 15px;
  display: block;
}

.age-interaction input[type="range"] {
  width: 80%;
  margin: 15px 0;
  cursor: pointer;
}

.age-interaction span {
  display: block;
  margin-top: 10px;
  font-size: 1.1em;
  color: var(--light-grey);
}

#ageSlider {
  width: 300px;
  margin: 10px;
  -webkit-appearance: none;
  background: linear-gradient(90deg, #6a82fb 0%, #b06cfa 100%);
  height: 6px;
  border-radius: 3px;
  outline: none;
  transition: box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(176,108,250,0.08);
}
#ageSlider:focus {
  box-shadow: 0 0 0 3px rgba(176,108,250,0.18);
}
#ageSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 2px 8px rgba(176,108,250,0.18);
  border: 2px solid rgba(176,108,250,0.18);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: -11px;
}
#ageSlider:active::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(176,108,250,0.28);
}
#ageSlider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 2px 8px rgba(176,108,250,0.18);
  border: 2px solid var(--white);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
#ageSlider:active::-moz-range-thumb {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(176,108,250,0.28);
}
#ageSlider::-ms-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 2px 8px rgba(176,108,250,0.18);
  border: 2px solid var(--white);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
#ageSlider:active::-ms-thumb {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(176,108,250,0.28);
}
#ageSlider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #6a82fb 0%, #b06cfa 100%);
}
#ageSlider::-ms-fill-lower {
  background: #6a82fb;
}
#ageSlider::-ms-fill-upper {
  background: #b06cfa;
}
#ageSlider:focus::-ms-fill-lower {
  background: #6a82fb;
}
#ageSlider:focus::-ms-fill-upper {
  background: #b06cfa;
}
#ageSlider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #6a82fb 0%, #b06cfa 100%);
}
#ageSlider::-ms-tooltip {
  display: none;
}

/* ListeningTime Styles */
.boxplot-box {
  opacity: 0.7;
  border-radius: 6px;
}
.boxplot-median {
  stroke: var(--red);
  stroke-width: 3px;
}
.boxplot-whisker {
  stroke: var(--dark-grey);
  stroke-width: 2px;
}
.boxplot-outlier {
  opacity: 0.7;
}
.boxplot-label {
  font-size: 15px;
  fill: #222;
  text-anchor: middle;
}

.age-lt18 { fill: #a6a177; }
.age-18_25 { fill: #80efed; }
.age-26_35 { fill: #c85656; }
.age-36_50 { fill: #9577a6; }
.age-50plus { fill: #8dda5c; }


/* Banner styles */
#banner {
  background: radial-gradient(circle at center, var(--dark-grey) 0%, var(--black) 100%);
  color: white;
  text-align: center;
  padding: 120px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}
.boxplot_hours_generation{
  width:900px;
  height: 500px;
}
.age-lt18 { fill: #a6a177; }
.age-18_25 { fill: #80efed; }
.age-26_35 { fill: #c85656; }
.age-36_50 { fill: #9577a6; }
.age-50plus { fill: #8dda5c; }


#banner h1 {
  font-size: 3em;
  margin-bottom: 0.5em;
}

#banner p {
  color: var(--light-grey);
  max-width: 800px;
  margin: 0 auto 20px;
  text-align: center;
}

/* Year filter styles */
.year-filter {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 18px;
  justify-content: center;
  background: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  width: 100%;
  margin: 0 0 18px 0;
}

.year-filter label {
  margin: 0;
  font-weight: 500;
  white-space: nowrap;
}
#yearSlider {
  flex: 1 1 300px;
  min-width: 180px;
  max-width: 350px;
}
#yearOutput {
  margin: 0 10px;
  font-size: 1.1em;
  color: var(--dark-grey);
  white-space: nowrap;
}
.year-toggle {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

#music_circular_packing {
  flex: 1;
}

/* Disable year slider when showing all years */
.year-filter.disabled input[type="range"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Chart tooltip styles */
.chart-tooltip {
  position: absolute;
  z-index: 9999 !important;
  pointer-events: none;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  opacity: 0;
  transition: opacity 0.2s;
  color: #222;
  min-width: 180px;
  max-width: 320px;
  line-height: 1.5;
}

/* Sort buttons styles */
.sort-buttons button {
    transition: all 0.2s ease;
}

.sort-buttons button:hover {
    background-color: #f0f0f0;
    border-color: #999;
}

.sort-buttons button:active {
    background-color: #e0e0e0;
    transform: translateY(1px);
}

/* Chart container additional styles */
.chart-container svg {
    overflow: visible;
}

.chart-container .bar-group rect {
    transition: opacity 0.2s ease;
}

.chart-container .bar-group rect:hover {
    opacity: 1 !important;
}

.filters {
  display: flex;
  flex-direction: row;
  gap: 20px;
  margin-bottom: 18px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

.main-content {
  scroll-snap-type: y mandatory;
  overflow-y: auto;
  height: 100vh;
}

section {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 40px;
}

.header-particles {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.header-dot {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
  transition: opacity 0.3s;
}

.header-note {
  position: absolute;
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
  transition: opacity 0.3s;
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  filter: drop-shadow(0 1px 2px rgba(176,108,250,0.12));
}

.banner-tagline {
  font-size: 1.25em;
  color: var(--purple);
  margin-bottom: 10px;
  font-weight: 500;
  text-align: center;
}
.banner-journey {
  color: var(--light-grey);
  font-size: 1.05em;
  margin-bottom: 18px;
  text-align: center;
}

section:last-of-type {
  background: radial-gradient(circle at center, var(--dark-grey) 0%, var(--black) 100%);
  color: white;
  text-align: center;
  padding: 60px 20px;
  margin-top: 0;
  box-shadow: var(--box-shadow);
}
section:last-of-type h2 {
  font-size: 2.2em;
  color: var(--purple);
}
section:last-of-type .resources-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 500px;
}
section:last-of-type .resources-list li {
  margin: 18px 0;
}
section:last-of-type .resources-list a {
  color: var(--lavender);
  font-size: 1.15em;
  text-decoration: none;
  transition: color 0.2s;
}
section:last-of-type .resources-list a:hover {
  color: var(--white);
  text-decoration: underline;
}

#yearSlider {
  width: 300px;
  margin: 10px;
  -webkit-appearance: none;
  background: linear-gradient(90deg, var(--blue) 0%, var(--purple) 100%);
  height: 6px;
  border-radius: 3px;
  outline: none;
  transition: box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(176,108,250,0.08);
}
#yearSlider:focus {
  box-shadow: 0 0 0 3px rgba(176,108,250,0.18);
}
#yearSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 2px 8px rgba(176,108,250,0.18);
  border: 2px solid rgba(176,108,250,0.18);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: -11px;
}
#yearSlider:active::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(176,108,250,0.28);
}
#yearSlider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 2px 8px rgba(176,108,250,0.18);
  border: 2px solid var(--white);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
#yearSlider:active::-moz-range-thumb {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(176,108,250,0.28);
}
#yearSlider::-ms-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 2px 8px rgba(176,108,250,0.18);
  border: 2px solid var(--white);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
#yearSlider:active::-ms-thumb {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(176,108,250,0.28);
}
#yearSlider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--purple) 100%);
}
#yearSlider::-ms-fill-lower {
  background: var(--blue);
}
#yearSlider::-ms-fill-upper {
  background: var(--purple);
}
#yearSlider:focus::-ms-fill-lower {
  background: var(--blue);
}
#yearSlider:focus::-ms-fill-upper {
  background: var(--purple);
}
#yearSlider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--purple) 100%);
}
#yearSlider::-ms-tooltip {
  display: none;
}

.filters select {
  padding: 8px 28px 8px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--purple);
  background: var(--white);
  color: var(--dark-grey);
  font-size: 1.08em;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(176,108,250,0.06);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  margin-right: 8px;
}
.filters select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(176,108,250,0.13);
}
.filters select:hover {
  border-color: var(--blue);
}
.filters option {
  color: var(--dark-grey);
  background: var(--white);
}

.chart-title {
  font-size: 18px;
  font-weight: bold;
  fill: var(--purple);
  text-anchor: middle;
  dominant-baseline: middle;
}
.chart-subtitle {
  font-size: 14px;
  fill: #666;
  text-anchor: middle;
  dominant-baseline: middle;
}
.axis-label {
  font-size: 15px;
  fill: #222;
  text-anchor: middle;
  dominant-baseline: middle;
}

/* Infocard styling */

.info-section {
  padding: 60px 20px;
  background: var(--white);
  display: flex;
  justify-content: center;
}

.info-card {
  max-width: 880px;
  background-color: var(--white);
  border: 1.5px solid var(--light-grey);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--box-shadow);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--dark-grey);
}

.info-card h3 {
  text-align: center;
  color: var(--purple);
  font-size: 1.6rem;
  margin-top: 0;
}

.info-card a {
  color: var(--purple);
  text-decoration: underline;
}


.card-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
}


.flip-card {
  background: transparent;
  width: 180px;
  height: 180px;
  perspective: 1000px;
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s;
  transform-style: preserve-3d;
  box-shadow: var(--box-shadow);
  border-radius: 16px;
}

.flip-card:hover .flip-inner,
.flip-card:focus-within .flip-inner {
  transform: rotateY(180deg);
}

.flip-front, .flip-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  font-size: 1rem;
  font-weight: 500;
  box-sizing: border-box;
  color: var(--dark-grey);
}

.flip-front {
  font-size: 1.2rem;
  background: var(--white); /* Default fallback */
}

.flip-front img {
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
}

.flip-back {
  color: white;

  transform: rotateY(180deg);
}

.flip-front.anxiety     { background-color: #66c2a5; }
.flip-front.depression  { background-color: #fc8d62; }
.flip-front.insomnia    { background-color: #8da0cb; }
.flip-front.ocd         { background-color: #e78ac3; }

.flip-back.anxiety      { background-color: #4ca58e; }
.flip-back.depression   { background-color: #e27245;}
.flip-back.insomnia     { background-color: #6c81b3; }
.flip-back.ocd          { background-color: #cc6ba6; }

.info-content p strong{
  background: var(--blur-bg);
  border-left: 4px solid var(--purple);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.5;
}

/*effect*/
.chart-container {
  margin: 40px auto;
  max-width: 1000px;
  padding: 20px;
}
.chart-title {
  font-size: 1.4rem;
  fill: var(--dark-grey);
}

.back-button {
    margin: 20px;
    text-align: right;
    width: 100%;
}

.back-button button {
    background-color: var(--purple);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    margin-right: 20px;
}

.back-button button:hover {
    background-color: var(--lavender);
}