/* Base */
html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Iowan Old Style BT", Georgia, serif;
  color: #111;
  background: #fff;
  line-height: 1.6;
}

/* Header / Nav */
header {
  position: fixed;
  top: 0;
  width: 100%;
  background: #fff;
  border-bottom: 1px solid #eee;
  z-index: 100;
}

nav {
  display: flex;
  justify-content: flex-end;
  gap: 2rem;
  padding: 1rem 2rem;
}

nav a {
  text-decoration: none;
  color: #111;
  font-weight: 500;
  font-size: 0.9rem;
  transition: opacity 0.2s ease;
}
nav a:hover {
  opacity: 0.6;
}

/* Mobile navigation adjustments */
@media (max-width: 768px) {
  nav {
    justify-content: space-between;
    gap: 0;
    padding: 1rem 0.5rem;
  }
  nav a {
    font-size: 1rem;
    white-space: nowrap;
    flex: 1;
    text-align: center;
  }
  #bibliForm input[type="email"],
  #bibliForm textarea {
    width: calc(100% - 0.5rem) !important;
    margin-right: 0.5rem;
    box-sizing: border-box;
  }
}

/* Extra small mobile screens */
@media (max-width: 480px) {
  nav {
    justify-content: space-between;
    gap: 0;
    padding: 1rem 0.4rem;
  }
  nav a {
    font-size: 0.8rem;
    flex: 1;
    text-align: center;
  }
  #bibliForm input[type="email"],
  #bibliForm textarea {
    width: calc(100% - 0.5rem) !important;
    margin-right: 0.5rem;
    box-sizing: border-box;
  }
}

/* Layout */
main {
  padding-top: 4rem;
}
section {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 2rem;
  padding-bottom: 2rem;
  text-align: center;
  scroll-margin-top: 6rem;
}
section:not(:first-of-type) {
  margin-top: 1.5rem;
}
#hero {
  padding-bottom: 1rem;
}
h1,
h2 {
  margin-bottom: 1rem;
  font-weight: 400;
}
h1 {
  font-size: 2.5rem;
  padding: 2rem 0 0.5rem 0;
}
.tagline {
  font-size: 1.1rem;
  color: #666;
  font-style: italic;
  margin-top: 0.5rem;
  padding: 0;
}
h2 {
  font-size: 1.2rem;
  margin: 0 auto 1rem auto;
  color: #666;
  font-style: italic;
  text-align: left;
  max-width: 600px;
}
section p {
  margin: 0 auto 1.2rem auto;
  max-width: 600px;
  font-size: 0.95rem;
  color: #333;
  text-align: left;
}
section p:last-child {
  margin-bottom: 0;
}
.form-container {
  max-width: 600px;
  margin: 1.2rem auto 0 auto;
}
section a {
  color: #666;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
section a:hover {
  opacity: 0.6;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid #eee;
  font-size: 0.8rem;
  color: #666;
  margin-top: 4rem;
}
footer a {
  color: #666;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
footer a:hover {
  opacity: 0.6;
}

/* Newsletter */
#newsletter h2 {
  text-align: left;
  font-size: 1.2rem;
  margin: 0 auto 1rem auto;
  color: #666;
  font-style: italic;
}

#newsletter form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

#newsletter form label {
  text-align: left;
  color: #333;
  font-weight: 500;
  font-size: 0.95rem;
}

#newsletter input,
#newsletter textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid #ddd;
  border-radius: 0;
  font-family: inherit;
  font-size: 0.95rem;
  color: #333; /* match body text color */
  background: #fff;
}

#newsletter textarea {
  min-height: 60px;
  resize: vertical;
}

#newsletter button {
  background: #fff;
  color: #333;
  border: 1px solid #333;
  padding: 0.6rem 1.2rem;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
  align-self: flex-start;
  font-family: inherit;
  font-size: 0.95rem;
}

#newsletter button:hover {
  background: #fafafa;
}

#newsletter #loadingSpinner {
  margin-top: 0.5rem;
  text-align: left;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

#newsletter #loadingSpinner p {
  color: #333;
  margin: 0;
}

#newsletter #formResponse {
  margin: 2rem auto 0 auto;
  color: #333;
  max-width: 600px;
  text-align: left;
}

/* Inline "I'm a reader / author" line */
#newsletter .role-line {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: flex-start;
  font-size: 0.95rem;
  color: #333;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}
#newsletter .role-line label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

/* Custom checkbox */
#newsletter .role-line input[type="checkbox"] {
  all: unset;
  display: inline-block;
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 1px solid #333;
  background-color: #fff;
  cursor: pointer;
  position: relative;
  transform: translateY(1px);
  transition: all 0.2s ease;
}

/* Filled black when checked */
#newsletter .role-line input[type="checkbox"]:checked {
  background-color: #111;
}

/* White checkmark (perfectly centered) */
#newsletter .role-line input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.8px 1.8px 0;
  transform: translate(-50%, -50%) rotate(45deg);
  transform-origin: center;
}
