/* ===========================================
   Gematria tool pages (pillar + Greek satellite)
   Loaded only on /calculators/gematria/ and
   /calculators/greek-gematria/
   =========================================== */

:root {
  --font-polyglot: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, 'Helvetica Neue', 'Arial Unicode MS', 'Lucida Sans Unicode',
    'Noto Sans', Arial, sans-serif;
}

/* Hebrew / Greek glyph rendering (incl. final forms + archaic letters) */
.glyph,
.reference-table tbody th:first-child,
.reference-table td:first-child {
  font-family: var(--font-polyglot);
}

/* Text input with inline clear control */
.input-clear-wrap {
  position: relative;
}

.input-clear-wrap input {
  width: 100%;
  padding-right: 3rem;
  font-size: 1rem; /* >= 16px, prevents iOS zoom-on-focus */
  font-family: var(--font-polyglot);
}

.input-clear {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--color-text-light);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.input-clear:hover {
  color: var(--color-text);
  background: var(--color-border-light);
}

.input-clear:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Alphabet selector: pills on wider screens, dropdown below 400px */
.alphabet-select {
  display: none;
}

@media (max-width: 400px) {
  .alphabet-pills {
    display: none;
  }
  .alphabet-select {
    display: block;
  }
}

/* Result panel */
.gematria-total {
  font-size: 2.75rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  margin: 0.5rem 0 0.25rem;
  line-height: 1.1;
}

@media (max-width: 640px) {
  .gematria-total {
    font-size: 2.25rem;
  }
}

.result-context {
  display: block;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 0.5rem;
}

.gematria-result + .gematria-result {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border-light);
}

.transformed-line {
  text-align: center;
  font-family: var(--font-polyglot);
  font-size: 1.125rem;
  margin: 0.25rem 0;
}

/* Per-letter breakdown chips: horizontal momentum scroll, never wrap */
.chip-strip {
  display: flex;
  gap: 0.375rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.375rem 0 0.5rem;
}

.letter-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 2.5rem;
  padding: 0.375rem 0.5rem;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  flex: 0 0 auto;
}

.chip-letter {
  font-family: var(--font-polyglot);
  font-size: 1.25rem;
  line-height: 1.3;
}

.chip-map {
  font-family: var(--font-polyglot);
  font-size: 0.9375rem;
  line-height: 1.2;
  color: var(--color-text-light);
}

.chip-value {
  font-size: 0.75rem;
  color: var(--color-text-light);
  font-variant-numeric: tabular-nums;
}

.sum-line {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  text-align: center;
  overflow-wrap: anywhere;
  margin: 0.25rem 0 0.5rem;
}

/* Inline notes inside the tool */
.inline-note {
  font-size: 0.875rem;
  color: var(--color-text-light);
  margin: 0.5rem 0 0;
  text-align: center;
}

.inline-note--attention {
  color: var(--color-primary-dark);
}

.result-links {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  text-align: center;
}

/* Collapsible disclosure panels (compare-all, normalisation) */
.tool-disclosure {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-white);
  margin-top: 1rem;
}

.tool-disclosure summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.625rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  list-style: none;
}

.tool-disclosure summary::-webkit-details-marker {
  display: none;
}

.tool-disclosure summary::before {
  content: '+';
  margin-right: 0.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.tool-disclosure[open] summary::before {
  content: '\2212';
}

.tool-disclosure summary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.tool-disclosure[open] summary {
  border-bottom: 1px solid var(--color-border-light);
}

.disclosure-body {
  padding: 0.75rem 1rem 1rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  cursor: pointer;
  font-size: 0.9375rem;
}

.check-row input {
  width: 1.125rem;
  height: 1.125rem;
  flex: 0 0 auto;
  accent-color: var(--color-primary);
}

/* Reverse lookup results */
.lexicon-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.lexicon-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.625rem 0.75rem;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.lexicon-word {
  font-family: var(--font-polyglot);
  font-size: 1.125rem;
  font-weight: 600;
}

.lexicon-translit {
  color: var(--color-text-light);
  font-style: italic;
}

.lexicon-gloss {
  color: var(--color-text);
  font-size: 0.9375rem;
}

.lexicon-value {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.nearest-values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.5rem;
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .jump-pill,
  .input-clear,
  .letter-chip {
    transition: none;
  }
  .jump-pill:hover {
    transform: none;
  }
}
