/* ==============================
   SANASTO - TYYLIT
   ============================== */

/* Sanasto-sivu layout */
.glossary-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Haku */
.glossary-search {
  margin-bottom: 3rem;
  text-align: center;
}

.glossary-search input {
  width: 100%;
  max-width: 600px;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  border: 2px solid rgba(240, 240, 240, 0.2);
  background: rgba(240, 240, 240, 0.05);
  color: var(--brand);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.glossary-search input:focus {
  outline: none;
  border-color: rgba(240, 240, 240, 0.4);
  background: rgba(240, 240, 240, 0.08);
}

.glossary-search input::placeholder {
  color: rgba(240, 240, 240, 0.4);
}

/* Termi-ruudukko */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

@media (max-width: 768px) {
  .glossary-grid {
    grid-template-columns: 1fr;
  }
}

/* Yksittäinen termikortti */
.glossary-card {
  background: rgba(240, 240, 240, 0.03);
  border: 1px solid rgba(240, 240, 240, 0.1);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.glossary-card:hover {
  background: rgba(240, 240, 240, 0.05);
  border-color: rgba(240, 240, 240, 0.2);
  transform: translateY(-2px);
}

.glossary-card.highlight {
  border-color: rgba(240, 240, 240, 0.5);
  background: rgba(240, 240, 240, 0.08);
  box-shadow: 0 0 20px rgba(240, 240, 240, 0.1);
}

/* Kortin header */
.glossary-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.glossary-term {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand);
  margin: 0;
  line-height: 1.2;
}

/* Kategoria-badge */
.glossary-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(240, 240, 240, 0.1);
  border-radius: 4px;
  color: rgba(240, 240, 240, 0.7);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Koko nimi */
.glossary-full {
  font-size: 0.9rem;
  color: rgba(240, 240, 240, 0.6);
  font-style: italic;
  margin-bottom: 0.75rem;
}

/* Määritelmä */
.glossary-definition {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(240, 240, 240, 0.85);
  margin-bottom: 1rem;
}

/* Esimerkki */
.glossary-example {
  padding: 0.75rem;
  background: rgba(240, 240, 240, 0.05);
  border-left: 3px solid rgba(240, 240, 240, 0.2);
  border-radius: 4px;
  font-size: 0.9rem;
  color: rgba(240, 240, 240, 0.7);
  line-height: 1.5;
}

.glossary-example strong {
  color: var(--brand);
  display: block;
  margin-bottom: 0.25rem;
}

/* Ei tuloksia */
.no-results {
  text-align: center;
  font-size: 1.2rem;
  color: rgba(240, 240, 240, 0.5);
  padding: 3rem;
}

/* ==============================
   INLINE TERMIT & TOOLTIPS
   ============================== */

/* Inline-termit muilla sivuilla */
.glossary-term-inline {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: rgba(240, 240, 240, 0.3);
  text-underline-offset: 3px;
  cursor: help;
  transition: all 0.2s ease;
}

.glossary-term-inline:hover {
  text-decoration-color: rgba(240, 240, 240, 0.6);
  text-decoration-style: solid;
  color: #ffffff;
}

/* Tooltip */
.glossary-tooltip {
  position: absolute;
  z-index: 10000;
  max-width: 400px;
  background: rgba(20, 20, 20, 0.98);
  border: 1px solid rgba(240, 240, 240, 0.3);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: none;
}

.glossary-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.glossary-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid rgba(240, 240, 240, 0.3);
}

.tooltip-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(240, 240, 240, 0.1);
}

.tooltip-header strong {
  font-size: 1.1rem;
  color: var(--brand);
}

.tooltip-full {
  font-size: 0.85rem;
  color: rgba(240, 240, 240, 0.6);
  font-style: italic;
}

.tooltip-body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(240, 240, 240, 0.85);
  margin-bottom: 0.75rem;
}

.tooltip-footer {
  font-size: 0.75rem;
  color: rgba(240, 240, 240, 0.5);
  text-align: center;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(240, 240, 240, 0.1);
}

/* Mobile-optimointi */
@media (max-width: 768px) {
  .glossary-tooltip {
    max-width: 90vw;
    left: 5vw !important;
    right: 5vw !important;
  }
  
  .glossary-search input {
    font-size: 1rem;
  }
  
  .glossary-card {
    padding: 1.25rem;
  }
  
  .glossary-term {
    font-size: 1.25rem;
  }
}

/* Print-tyylit */
@media print {
  .glossary-search,
  .glossary-tooltip {
    display: none !important;
  }
  
  .glossary-card {
    page-break-inside: avoid;
    border: 1px solid #333;
  }
  
  .glossary-term-inline {
    text-decoration: none;
    font-weight: 600;
  }
}
