:root {
  /* Core palette */
  --bg-overlay: rgba(6, 7, 22, 0.7); /* midnight navy veil */
  --surface: rgba(255, 255, 255, 0.92); /* frosted white */
  --primary: #ef476f; /* raspberry */
  --primary-dark: #ba1c45; /* deep rose */
  --secondary: #ffd166; /* warm sunflower */
  --accent: #06d6a0; /* jade */
  --text-dark: #0b0b11; /* ink */
  --text-light: #f5f7ff; /* soft dove */

  /* Shadows & radii */
  --shadow-lg: 0 20px 50px rgba(3, 6, 30, 0.35);
  --shadow-md: 0 10px 20px rgba(239, 71, 111, 0.35);
  --shadow-sm: 0 8px 18px rgba(15, 30, 54, 0.15);
  --radius-card: 1.5rem;
  --radius-pill: 999px;

  /* Motion */
  --transition-float: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;

  font-size: 16px; /* keep default root sizing for predictable rem calculations */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: 'Fredoka', 'Space Grotesk', 'Trebuchet MS', system-ui, sans-serif;
  color: var(--text-light);
  background-color: #02040f;
  background-image: linear-gradient(var(--bg-overlay), var(--bg-overlay)),
    url('tree-of-life.svg');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
  line-height: 1.6;
}

a,
button {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.skip-link {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -40px;
  background: var(--secondary);
  color: #111;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: top 0.3s ease;
  z-index: 10;
}

.skip-link:focus {
  top: 20px;
}

.page-header {
  padding: 3.5rem 1.5rem 1rem;
  text-align: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: var(--secondary);
  margin-bottom: 0.5rem;
}

h1 {
  margin: 0 auto 1rem;
  font-size: clamp(2.5rem, 4vw, 3.75rem);
}

.intro {
  max-width: 37rem;
  margin: 0 auto;
  min-height: 3.5rem; /* reserves space before quotes mount */
}

.pill-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0 1rem 2rem;
}

.pill {
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.85rem 1.75rem;
  background: var(--surface);
  color: var(--text-dark);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transition: var(--transition-float);
}

.pill[aria-pressed='true'] {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.pill:focus-visible {
  outline: none;
  border-color: var(--accent);
  transform: translateY(-2px);
}

main {
  display: flex;
  justify-content: center;
  padding: 0 1rem 3rem;
}

.feature-panel {
  width: min(960px, 100%);
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 2rem;
  color: var(--text-dark);
  box-shadow: var(--shadow-lg);
}

.feature-panel h2 {
  font-size: clamp(2rem, 3vw, 2.5rem);
  margin-top: 0;
}

.feature-panel p {
  margin-bottom: 1.25rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dark);
}

.primary {
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.9rem 1.75rem;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transition: var(--transition-float);
}

.primary:hover,
.primary:focus-visible {
  transform: translateY(-2px);
}

.tertiary {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary-dark);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1.25rem;
  font-weight: 600;
  transition: var(--transition-float);
}

.icon-button {
  border: none;
  background: #f1f4ff; /* misty lavender */
  border-radius: var(--radius-pill);
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-float);
}

.icon-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: var(--primary-dark);
}

.primary:hover,
.tertiary:hover,
.icon-button:hover,
.icon-button:focus-visible,
.tertiary:focus-visible {
  transform: translateY(-1px);
}

.icon-button:disabled {
  opacity: 0.4;
  transform: none;
}

.pairs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.pair-card {
  border-radius: 1rem;
  padding: 1rem;
  background: #f4f6ff; /* pale periwinkle */
  border: 2px solid #e3e6ff; /* cool lilac */
}

.pair-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--primary-dark);
}

.pair-card ul,
.role-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.role-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.role-pill {
  background: #eef7f3; /* mint foam */
  border-radius: var(--radius-pill);
  padding: 0.65rem 1rem;
  border: 2px solid transparent;
  font-weight: 600;
  transition: var(--transition-float);
}

.role-pill span {
  display: inline-block;
}

.role-pill.current {
  border-color: var(--accent);
  background: #c9fff0; /* bright mint */
}

.role-pill:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.descriptor {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 600;
}

.descriptor .tertiary {
  margin-top: 0.2rem;
}

.descriptor button {
  border: none;
  background: var(--secondary);
  color: #2f1b09;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-weight: 700;
  transition: var(--transition-float);
}

.descriptor button:hover,
.descriptor button:focus-visible {
  transform: translateY(-1px);
}

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-light);
}

.quote-play {
  font-style: italic;
  color: var(--secondary);
  letter-spacing: 0.03em;
}

.quote-char {
  display: inline-block;
  white-space: pre; /* preserves natural spacing inside each span */
  transition: color 0.2s ease, transform 0.2s ease;
}

.quote-char:hover {
  color: var(--accent);
  transform: translateY(-2px) scale(1.05);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75); /* smoky charcoal overlay */
  padding: 1rem;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay[aria-hidden='false'] {
  visibility: visible;
  opacity: 1;
}

.modal {
  background: #fff;
  color: var(--text-dark);
  max-width: 480px; /* px keeps modal readable on large screens regardless of user font scaling */
  width: 100%;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.modal-body {
  margin: 1rem 0 1.5rem;
  font-size: 1rem;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .feature-panel {
    padding: 1.5rem;
  }

  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pill {
    width: 100%;
  }

  .modal {
    max-width: 100%; /* override px width so small devices use full viewport width */
  }
}
