:root {
  --ink: #111;
  --muted: #9ca3af;
  --line: #e5e7eb;
  --serif: 'Garamond Premier Pro', 'EB Garamond', Garamond, Georgia, serif;
}

* { box-sizing: border-box; }

/* Ensure the `hidden` attribute always wins over flex/grid display rules below. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title {
  font-weight: 400;
  font-size: 2.75rem;
  letter-spacing: 0.04em;
  margin: 0.5rem 0 2.5rem;
  text-align: center;
}

/* --- buttons --- */
.actions {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  width: 100%;
  max-width: 360px;
}

.action-btn {
  display: block;
  width: 100%;
  text-align: center;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 0.85rem 1rem;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}
.action-btn:hover { opacity: 0.55; }
.beta { font-size: 0.7em; color: var(--muted); letter-spacing: 0.02em; }
.action-btn:active { background: var(--ink); color: #fff; opacity: 1; }

/* --- status --- */
.status {
  margin: 1.75rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-align: center;
}
.status.error { color: #b91c1c; }

/* --- pdf result --- */
.pdf-result { width: 100%; margin-top: 2rem; }
.caption {
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  text-align: center;
  margin: 0 0 0.9rem;
}
.pdf-frame {
  width: 100%;
  height: 78vh;
  border: 1px solid var(--line);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
#pdf-object { width: 100%; height: 100%; }

/* --- ocr result --- */
.ocr-result { width: 100%; max-width: 460px; margin-top: 2rem; }
.ocr-result h2 {
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: 0.03em;
  text-align: center;
  margin: 0 0 1rem;
}
.producer-list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: center;
}
.producer-list li {
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--line);
}
.producer-list li:last-child { border-bottom: none; }
.ocr-empty { color: var(--muted); text-align: center; letter-spacing: 0.03em; }

/* --- manual lookup --- */
.lookup {
  width: 100%;
  max-width: 460px;
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lookup-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--muted);
  letter-spacing: 0.03em;
  transition: opacity 0.2s;
}
.lookup-toggle:hover { opacity: 0.6; }
.lookup-panel {
  width: 100%;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
#lookup-input {
  width: 100%;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink);
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  resize: vertical;
}
#lookup-input:focus { outline: none; border-color: var(--ink); }
#lookup-result { margin-top: 0.5rem; }

/* --- footer --- */
.footer {
  margin-top: 4.5rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.footer-line {
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  text-align: center;
  margin: 0 0 1.25rem;
}
.footer-img {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: 2px;
}

@media (min-width: 600px) {
  .title { font-size: 3.25rem; }
}
