/* unpaywall: minimal, dark, full-bleed layout.
 * No width caps, Open Runde typeface, generous spacing. */

@font-face {
  font-family: "Open Runde";
  src: url("fonts/OpenRunde-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Open Runde";
  src: url("fonts/OpenRunde-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Open Runde";
  src: url("fonts/OpenRunde-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Open Runde";
  src: url("fonts/OpenRunde-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: clamp(1.5rem, 6vw, 5rem);
  background: #000;
  color: #e0e0e0;
  font-family: "Open Runde", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Header ---------- */

header {
  margin-bottom: clamp(2.5rem, 8vw, 5rem);
}

h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

/* ---------- Search form ---------- */

form label {
  display: block;
  margin-bottom: 0.75rem;
  color: #9a9a9a;
  font-size: 0.95rem;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: stretch;
}

input[type="text"] {
  flex: 1 1 22rem;
  min-width: 0;
  padding: 1rem 1.25rem;
  background: #080808;
  border: 1px solid #333;
  border-radius: 0;
  color: #e0e0e0;
  font: inherit;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
}

input::placeholder {
  color: #555;
}

button {
  border-radius: 0;
  cursor: pointer;
  font: inherit;
}

#submit-button {
  flex: 0 0 auto;
  padding: 1rem 2rem;
  background: #e0e0e0;
  border: 1px solid #e0e0e0;
  color: #000;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  font-weight: 600;
}

#submit-button:hover:not(:disabled) {
  background: #fff;
  border-color: #fff;
}

#submit-button:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ---------- Loading / error feedback ---------- */

.message {
  min-height: 1.6em;
  margin-top: 1.25rem;
  color: #9a9a9a;
}

.message.error {
  color: #ff8f8f;
}

/* ---------- Search progress ---------- */

.progress {
  margin-top: 1.25rem;
}

.progress[hidden] {
  display: none;
}

.progress-track {
  position: relative;
  height: 6px;
  overflow: hidden;
  background: #222;
  border-radius: 3px;
}

.progress-fill {
  position: relative;
  width: 4%;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #6a5acd, #36d1dc, #6a5acd);
  background-size: 200% 100%;
  box-shadow: 0 0 14px rgba(54, 209, 220, 0.5);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  animation: progress-flow 2s linear infinite;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8));
  animation: progress-glint 1.4s ease-in-out infinite;
}

.progress-label {
  margin: 0.65rem 0 0;
  color: #bdbdbd;
  font-size: 0.95rem;
}

@keyframes progress-flow {
  from { background-position: 0% 50%; }
  to { background-position: 200% 50%; }
}

@keyframes progress-glint {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill,
  .progress-fill::after {
    animation: none;
  }
}

/* ---------- Results: shared ---------- */

.results {
  margin-top: 2rem;
}

.results:empty {
  display: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid #e0e0e0;
  outline-offset: 3px;
}

.muted {
  color: #7a7a7a;
}

/* ---------- "oa": paper + every open-access source ---------- */

.paper-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 5vw, 3rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.meta {
  margin: 0 0 2rem;
  color: #9a9a9a;
}

.oa-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.oa-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #0a0a0a;
  border: 1px solid #262626;
}

.oa-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #e0e0e0;
  border: 1px solid #e0e0e0;
  color: #000;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.oa-link:hover {
  background: #fff;
  border-color: #fff;
}

.oa-source {
  color: #8a8a8a;
  font-size: 0.9rem;
}

/* ---------- "email": every contact, then the example email ---------- */

.status-title {
  margin: 0 0 2rem;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 500;
  line-height: 1.2;
}

.contact-card + .contact-card {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #222;
}

.author-name {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.author-institution {
  margin: 0 0 1rem;
  color: #9a9a9a;
}

.email-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.email-link,
.secondary-link {
  color: #e0e0e0;
  text-decoration: underline;
  text-underline-offset: 0.25rem;
}

.email-link:hover,
.secondary-link:hover {
  color: #fff;
}

/* Guessed addresses are shown, but flagged so they get verified. */
.likely-label {
  display: inline-block;
  color: #d7b96a;
  font-size: 0.85rem;
}

.verified-note,
.email-source {
  color: #7a7a7a;
  font-size: 0.8rem;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0.75rem 0 0;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1rem;
}

.no-email-note {
  margin: 0;
  color: #c9c9c9;
}

/* The single, high-contrast email search action for each contact. */
.search-email-button {
  display: inline-block;
  padding: 1rem 1.75rem;
  background: #e0e0e0;
  border: 2px solid #e0e0e0;
  color: #000;
  font-size: clamp(1.05rem, 2.5vw, 1.2rem);
  font-weight: 700;
  text-decoration: none;
}

.search-email-button:hover {
  background: #fff;
  border-color: #fff;
  transform: translateY(-1px);
}

/* ---------- Example email composition card ---------- */

.email-card {
  margin-top: 2.5rem;
  padding: 1.5rem;
  border: 1px solid #333;
  background: #050505;
}

.card-header {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
  font-weight: 500;
}

.email-field {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #1c1c1c;
}

.field-label {
  min-width: 4.5rem;
  color: #8a8a8a;
  font-size: 0.9rem;
}

.field-value {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.email-body {
  margin: 1.25rem 0 1.5rem;
}

.email-body p {
  margin: 0 0 1rem;
}

mark.placeholder {
  padding: 0 0.15em;
  background: #ffe000;
  color: #000;
  font-weight: 700;
}

.copy-button {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 1px solid #444;
  color: #e0e0e0;
}

.copy-button:hover {
  background: #151515;
  border-color: #888;
}


/* ---------- Mobile ---------- */

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
  }

  #submit-button {
    width: 100%;
  }

  .search-email-button {
    width: 100%;
    text-align: center;
  }
}
