/* Pinakes Manuscript Search — inspired by sypianski.cc */

@import url('https://fonts.googleapis.com/css2?family=Alegreya:ital,wght@0,400;0,500;0,700;1,400;1,500&family=Manrope:wght@400;500&family=Jacquard+12&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Manrope', sans-serif;
  background: #f7f5f0;
  color: #1a1a1a;
  line-height: 1.7;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  text-align: center;
}

/* ── Header ─────────────────────────────────────── */

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

h1 {
  font-family: 'Jacquard 12', serif;
  font-size: 4.5rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  display: inline-block;
  width: 100%;
  background: linear-gradient(
    90deg,
    #1a1a1a 0%,
    #1a1a1a 40%,
    #c9a227 50%,
    #1a1a1a 60%,
    #1a1a1a 100%
  );
  background-size: 200% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s ease-in-out forwards;
}

h1:hover {
  animation: shimmer 2s ease-in-out forwards;
}

@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.header-top {
  display: flex;
  align-items: baseline;
  justify-content: center;
  position: relative;
}

.lang-switch {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.lang-opt {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Alegreya', serif;
  font-size: 0.82rem;
  font-style: italic;
  color: #c8c3b8;
  padding: 0.1rem 0;
  transition: color 0.2s ease;
  position: relative;
}

.lang-opt:hover {
  color: #8a6a10;
}

.lang-opt.active {
  color: #807b72;
  cursor: default;
}

.lang-opt.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: #c9a227;
}

.lang-dot {
  font-size: 0.6rem;
  color: #d0cbbf;
  user-select: none;
}

.subtitle {
  font-family: 'Alegreya', serif;
  font-size: 1.05rem;
  font-style: italic;
  color: #807b72;
}

.beta-badge {
  font-family: 'Manrope', sans-serif;
  font-style: normal;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a63431;
  background: rgba(166, 52, 49, 0.08);
  border: 1px solid rgba(166, 52, 49, 0.2);
  padding: 0.15rem 0.45rem;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.subtitle a {
  color: #807b72;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #c8c3b8;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.subtitle a:hover {
  color: #8a6a10;
  text-decoration-color: #c9a227;
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #c9a22760 20%, #d0c8b8 50%, #c9a22760 80%, transparent);
  margin: 2rem 0;
}

/* ── Main ────────────────────────────────────────── */

main {
  flex: 1;
}

/* ── Search Box ──────────────────────────────────── */

.search-box {
  margin-bottom: 2rem;
}

.db-update-note {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  color: #aaa8a2;
  letter-spacing: 0.01em;
}

form {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #e0dcd4;
  border-bottom: 2px solid #d0cbbf;
  padding: 1rem 1.25rem;
  gap: 0.75rem;
  transition: border-color 0.2s ease;
}

form:focus-within {
  border-color: #c9a22780;
  border-bottom-color: #c9a227;
}

input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'Alegreya', serif;
  font-size: 1.35rem;
  color: #1a1a1a;
  background: transparent;
  padding: 0.3rem 0;
}

input[type="text"]::placeholder {
  color: #b0ab9f;
  font-style: italic;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  color: #c0bab0;
  transition: color 0.2s ease;
  padding: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

button:hover {
  color: #b8941f;
}

/* ── Result ──────────────────────────────────────── */

.result {
  background: #faf8f3;
  border: 1px solid #e0dcd4;
  border-left: 3px solid #c9a227;
  padding: 1.5rem;
  margin-bottom: 2rem;
  animation: slideIn 0.2s ease;
  text-align: left;
}

.result.hidden {
  display: none;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-status {
  font-family: 'Manrope', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #807b72;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #ede9e2;
}

.status-emoji {
  margin-right: 0.4rem;
}

.status-emoji.success { color: #4a6e1a; }
.status-emoji.error   { color: #a63431; }

.result-details {
  margin-bottom: 1.25rem;
}

.details-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-section {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.75rem;
  align-items: baseline;
}

.detail-label {
  font-family: 'Manrope', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #b0ab9f;
}

.detail-value {
  color: #2a2720;
  font-family: 'Alegreya', serif;
  font-size: 1rem;
}

/* Diktyon hero display */
.diktyon-hero {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.diktyon-number {
  font-family: 'Manrope', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: 0.02em;
  line-height: 1;
}

.diktyon-label {
  font-family: 'Manrope', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b0ab9f;
}

.diktyon-copy {
  background: none;
  border: 1px solid #e0dcd4;
  cursor: pointer;
  color: #b0ab9f;
  font-family: 'Manrope', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.diktyon-copy:hover {
  color: #807b72;
  border-color: #c9a227;
  background: rgba(201, 162, 39, 0.05);
}

.diktyon-copy.copied {
  color: #4a6e1a;
  border-color: #4a6e1a;
}

.result-meta {
  font-family: 'Alegreya', serif;
  font-size: 0.95rem;
  color: #807b72;
  font-style: italic;
  line-height: 1.5;
}

/* List sections (contents, people, identifiers) */
.detail-section--list {
  align-items: start;
}

.metadata-list {
  list-style: none;
  padding: 0;
}

.metadata-list li {
  font-family: 'Alegreya', serif;
  font-size: 1rem;
  color: #2a2720;
  line-height: 1.6;
}

/* ── Disambiguation ─────────────────────────────── */

.status-emoji.disambig { color: #b8941f; }

.disambig-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.disambig-heading {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.disambig-prefix {
  font-family: 'Alegreya', serif;
  font-size: 1.4rem;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.2;
}

.disambig-count {
  font-family: 'Manrope', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #b0ab9f;
  background: #ede9e2;
  padding: 0.15rem 0.45rem;
  border-radius: 1px;
}

.disambig-count::after {
  content: ' ms.';
}

.disambig-inst {
  font-family: 'Alegreya', serif;
  font-size: 0.88rem;
  font-style: italic;
  color: #a09a90;
  margin-bottom: 0.25rem;
}

/* Prompt to specify */
.disambig-prompt {
  font-family: 'Alegreya', serif;
  font-size: 0.92rem;
  color: #807b72;
  font-style: italic;
  padding: 0.5rem 0;
  border-bottom: 1px solid #ede9e2;
  margin-bottom: 0.25rem;
}

/* Exact match line */
.disambig-exact {
  padding: 0.3rem 0;
}

.disambig-exact-link {
  font-family: 'Alegreya', serif;
  font-size: 0.9rem;
  color: #807b72;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #d0cbbf;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.disambig-exact-link:hover {
  color: #8a6a10;
  text-decoration-color: #c9a227;
}

/* Collapsible groups */
.disambig-group {
  margin-top: 0.35rem;
}

.disambig-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid #ede9e2;
  cursor: pointer;
  padding: 0.4rem 0;
  transition: color 0.15s ease;
  justify-content: flex-start;
}

.disambig-group-header:hover {
  color: #8a6a10;
}

.disambig-group-header::before {
  content: '▸';
  font-size: 0.7rem;
  color: #c0bab0;
  transition: transform 0.2s ease;
}

.disambig-group.open .disambig-group-header::before {
  transform: rotate(90deg);
}

.disambig-group-label {
  font-family: 'Manrope', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #4a4740;
}

.disambig-group-count {
  font-family: 'Manrope', sans-serif;
  font-size: 0.6rem;
  font-weight: 500;
  color: #b0ab9f;
  background: #ede9e2;
  padding: 0.1rem 0.35rem;
  border-radius: 1px;
}

.disambig-group-body {
  display: none;
  padding-top: 0.5rem;
}

.disambig-group-body.expanded {
  display: block;
}

/* Chip grid — the concordance */
.disambig-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0.25rem 0;
}

.disambig-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 1.7rem;
  padding: 0 0.4rem;
  font-family: 'Manrope', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #4a4740;
  background: #fff;
  border: 1px solid #e0dcd4;
  text-decoration: none;
  transition: all 0.12s ease;
  animation: chipIn 0.25s ease both;
}

@keyframes chipIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.disambig-chip:hover {
  background: rgba(201, 162, 39, 0.1);
  border-color: #c9a227;
  color: #8a6a10;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(201, 162, 39, 0.15);
}

.disambig-chip:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Overflow chips: hidden by default, shown when grid is expanded */
.disambig-chip--overflow {
  display: none;
}

.disambig-grid--expanded .disambig-chip--overflow {
  display: inline-flex;
}

/* "Show more" toggle */
.disambig-toggle {
  font-family: 'Manrope', sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #b0ab9f;
  background: none;
  border: 1px dashed #d0cbbf;
  cursor: pointer;
  padding: 0 0.5rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s ease;
}

.disambig-toggle:hover {
  color: #8a6a10;
  border-color: #c9a227;
}

.error-message {
  color: #a63431;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.library-info {
  color: #807b72;
  font-size: 0.875rem;
  font-style: italic;
  margin-top: 0.4rem;
}

/* Action link */
.result-action {
  margin-top: 1rem;
}

.action-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: transparent;
  border: 1px solid rgba(201, 162, 39, 0.5);
  color: #b8941f;
  text-decoration: none;
  font-family: 'Manrope', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: all 0.2s ease;
}

.action-link::after {
  content: '→';
  transition: transform 0.2s ease;
}

.action-link:hover {
  background: rgba(201, 162, 39, 0.08);
  border-color: #c9a227;
  color: #96740f;
}

.action-link:hover::after {
  transform: translateX(2px);
}

/* ── Pinakes Offline Warning ─────────────────────── */

.pinakes-offline {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #996633;
  font-style: italic;
}

/* ── Report Error ────────────────────────────────── */

.result-report {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #ede9e2;
}

.result-report:empty {
  display: none;
}

.report-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #b0ab9f;
  padding: 0;
  transition: color 0.2s ease;
}

.report-toggle::before {
  content: '⚑';
  margin-right: 0.35rem;
  font-size: 0.75rem;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.report-toggle:hover {
  color: #a63431;
}

.report-toggle:hover::before {
  opacity: 1;
}

.report-toggle:disabled {
  cursor: default;
  opacity: 0.7;
}

.report-toggle.sent {
  color: #4a6e1a;
}

.report-toggle.sent::before {
  content: '✓';
  opacity: 1;
}

/* ── Examples / Concordance ──────────────────────── */

.examples {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  background: #faf8f3;
  border: 1px solid #ede9e2;
}

.examples > p {
  font-family: 'Manrope', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b0ab9f;
  margin-bottom: 1rem;
}

.concordance {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.concordance-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid #ede9e2;
}

.concordance-row:last-child {
  border-bottom: none;
}

.concordance-label {
  font-family: 'Manrope', sans-serif;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #b0ab9f;
  line-height: 1.6;
  padding-top: 0.1rem;
}

.concordance-variants {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.35rem;
}

.eq {
  font-family: 'Manrope', sans-serif;
  font-size: 0.7rem;
  color: #d0cbbf;
  user-select: none;
}

.example {
  font-family: 'Alegreya', serif;
  font-style: italic;
  font-size: 0.92rem;
  color: #4a4740;
  text-decoration: none;
  transition: color 0.15s ease;
  line-height: 1.5;
  white-space: nowrap;
}

.example:hover {
  color: #8a6a10;
}

.sep {
  color: #d0cbbf;
}


/* ── History ─────────────────────────────────────── */

.history {
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  background: #faf8f3;
  border: 1px solid #ede9e2;
  text-align: center;
}

.history.hidden {
  display: none;
}

.history-title {
  font-family: 'Manrope', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b0ab9f;
  margin-bottom: 0.75rem;
}

.history-list {
  line-height: 2;
}

.history-item {
  font-family: 'Alegreya', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: #4a4740;
  text-decoration: none;
  padding: 0.15rem 0.5rem;
  border: 1px solid #e0dcd4;
  transition: all 0.15s ease;
  display: inline-block;
  margin: 0.15rem;
}

.history-item:hover {
  border-color: rgba(201, 162, 39, 0.5);
  color: #8a6a10;
  background: rgba(201, 162, 39, 0.05);
}

/* ── Footer ──────────────────────────────────────── */

footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 0;
  color: #807b72;
}

.footer-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 1.5rem;
}

.footer-rule::before,
.footer-rule::after {
  content: '';
  flex: 1;
  max-width: 80px;
  height: 1px;
  background: linear-gradient(to var(--dir, right), transparent, #c9a22750);
}

.footer-rule::before { --dir: right; }
.footer-rule::after  { --dir: left; }

.footer-diamond {
  font-size: 0.35rem;
  color: #c9a227;
  padding: 0 0.6rem;
  line-height: 1;
}

.footer-author {
  font-family: 'Jacquard 12', serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: #4a4740;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.footer-author a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-author a:hover {
  color: #8a6a10;
}

.footer-disclaimer {
  font-family: 'Manrope', sans-serif;
  font-size: 0.65rem;
  color: #b8b3aa;
  margin-top: 0.25rem;
  letter-spacing: 0.02em;
}

.footer-disclaimer a {
  color: #a09a90;
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-disclaimer a:hover {
  color: #8a6a10;
}

.footer-links {
  font-family: 'Manrope', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #b0ab9f;
}

.footer-links a {
  color: #a09a90;
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: #8a6a10;
}

.footer-sep {
  margin: 0 0.4rem;
  color: #d0cbbf;
}

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 600px) {
  .container {
    padding: 2rem 1rem 3rem;
  }

  h1 {
    font-size: 3rem;
  }

  .concordance-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .concordance-label {
    padding-bottom: 0;
  }
}
