/* ===== Reset & Box Model ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== Base ===== */
body {
  font-family: "Lora", Georgia, serif;
  font-size: 1rem;
  line-height: 1.7;
  color: #222;
  background-color: #f5f5f5;
  max-width: 940px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Header ===== */
header {
  text-align: center;
  padding: 48px 0 32px;
  border-bottom: 1px solid #ddd;
}

.header-logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.8em;
}

.header-logo {
  height: 2.75rem;
  width: auto;
  display: block;
}

header h1 {
  font-size: 2.75rem;
  letter-spacing: 0.05em;
  color: #111;
}

/* ===== Main ===== */
main {
  padding: 32px 0;
}

/* Intro paragraphs — right-aligned */
main>p {
  text-align: left;
  margin-bottom: 1rem;
  font-size: 1rem;
  color: #333;
}

main>p:last-child {
  margin-bottom: 0;
}

main a {
  color: #555;
  text-underline-offset: 3px;
}

main a:hover {
  color: #000;
}

/* ===== Navbar ===== */
nav {
  border-bottom: 1px solid #ddd;
  background-color: #f5f5f5;
}

nav ul {
  display: flex;
  justify-content: center;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 940px;
}

nav ul li {
  position: relative;
}

nav ul li a {
  display: block;
  padding: 14px 22px;
  font-family: "Lora", Georgia, serif;
  font-size: 0.95rem;
  color: #333;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s ease;
}

nav ul li a:hover {
  color: #000;
}

/* Active/current page indicator */
nav ul li a.active {
  color: #000;
  border-bottom: 2px solid #555;
}

/* ===== Dropdown ===== */
nav ul li ul.dropdown {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  min-width: 130px;
  z-index: 100;
  padding: 6px 0;
}

nav ul li ul.dropdown li a {
  padding: 10px 18px;
  font-size: 0.875rem;
  color: #444;
  white-space: nowrap;
}

nav ul li ul.dropdown li a:hover {
  color: #000;
  background-color: #f5f5f5;
}

/* Show on hover (desktop) */
nav ul li:hover ul.dropdown {
  display: flex;
}

/* Show on tap (mobile — toggled via JS) */
nav ul li ul.dropdown.open {
  display: flex;
}

/* ===== Hamburger toggle button ===== */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 300;
  -webkit-appearance: none;
  appearance: none;
}

/* The body needs relative positioning context for the toggle button on mobile */
body {
  position: relative;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background-color: #333;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

/* Animate hamburger → X when open */
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== Button Container ===== */
.button-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 33px;
  margin: 0 auto 40px;
  max-width: 940px;
  padding: 0;
}

.custom-button {
  flex: 0 1 200px;
  /* Don't grow beyond image width */
  max-width: 200px;
  min-width: 160px;
  text-decoration: none;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  background-color: #fff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.custom-button:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.button-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.button-image {
  display: block;
  width: 100%;
  height: auto;
  max-width: 200px;
  padding: 30px;
}

.button-caption {
  padding: 14px 12px;
  font-size: 0.85rem;
  font-weight: normal;
  color: #222;
  line-height: 1.55;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 32px 0 40px;
  border-top: 1px solid #ddd;
  font-size: 0.875rem;
  color: #555;
}

footer p {
  margin-bottom: 0.6rem;
}

footer p:last-child {
  margin-bottom: 0;
}

footer a {
  color: #555;
  text-underline-offset: 3px;
}

footer a:hover {
  color: #000;
}

/* ===== Main Content — Headings & Lists ===== */
main h2 {
  font-size: 1.5rem;
  color: #111;
  margin: 32px 0 12px;
  letter-spacing: 0.02em;
}

main h3 {
  font-size: 1.15rem;
  color: #111;
  margin: 28px 0 10px;
  letter-spacing: 0.02em;
}

main ul {
  padding-left: 1.4em;
  /* Pulls bullets back into view */
  margin-bottom: 1rem;
}

main ul li {
  margin-bottom: 0.6rem;
  color: #333;
  font-size: 1rem;
  line-height: 1.7;
}

main ul li:last-child {
  margin-bottom: 0;
}

main ul li a,
main p a {
  color: #555;
  text-underline-offset: 3px;
}

main ul li a:hover,
main p a:hover {
  color: #000;
}

/* ===== Quotes ===== */
main figure {
  margin: 0 0 28px;
  padding: 20px 20px 16px;
  border-left: 3px solid #bbb;
  background-color: #fff;
  border-radius: 0 6px 6px 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

main figure:last-child {
  margin-bottom: 0;
}

main blockquote p {
  font-style: italic;
  color: #444;
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 10px;
}

main figcaption {
  font-size: 0.85rem;
  color: #777;
}

main figcaption a {
  color: #777;
  text-underline-offset: 3px;
}

main figcaption a:hover {
  color: #000;
}

/* ===== Form ===== */
main form {
  margin-top: 24px;
  max-width: 560px;
  /* Keeps the form a comfortable reading width */
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

main form label {
  font-size: 0.875rem;
  color: #555;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

main form input[type="text"],
main form input[type="email"],
main form textarea {
  font-family: "Lora", Georgia, serif;
  font-size: 1rem;
  color: #222;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 10px 12px;
  line-height: 1.6;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

main form input[type="text"]:focus,
main form input[type="email"]:focus,
main form textarea:focus {
  outline: none;
  border-color: #888;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

main form textarea {
  resize: vertical;
  /* Allow vertical resize only */
  min-height: 120px;
}

main form button[type="submit"] {
  font-family: "Lora", Georgia, serif;
  font-size: 0.95rem;
  color: #fff;
  background-color: #444;
  border: none;
  border-radius: 6px;
  padding: 12px 28px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  margin-top: 20px;
}

main form button[type="submit"]:hover {
  background-color: #222;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* ===== Share Button (navbar) ===== */
nav ul li button.share-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: block;
  padding: 14px 22px;
  font-family: "Lora", Georgia, serif;
  font-size: 0.95rem;
  color: #333;
  letter-spacing: 0.03em;
  line-height: inherit;
  /* match anchor line-height */
  text-decoration: none;
  /* belt & braces */
  transition: color 0.2s ease;
  -webkit-appearance: none;
  /* kill any platform-specific button styling */
  appearance: none;
}

nav ul li button.share-btn:hover {
  color: #000;
}

/* ===== Share Popup ===== */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-overlay[hidden] {
  display: none;
}

.share-popup {
  background: #fff;
  border-radius: 8px;
  padding: 32px 36px 28px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
  max-width: 340px;
  width: 90%;
  position: relative;
  text-align: center;
}

.share-popup-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #888;
  transition: color 0.2s ease;
}

.share-popup-close:hover {
  color: #000;
}

.share-popup-label {
  font-size: 0.875rem;
  color: #777;
  margin-bottom: 8px;
}

.share-popup-link {
  display: inline-block;
  font-size: 0.95rem;
  color: #333;
  text-underline-offset: 3px;
  margin-bottom: 28px;
  word-break: break-all;
}

.share-popup-link:hover {
  color: #000;
}

.share-icons {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.share-icons a img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  transition: opacity 0.2s ease;
}

.share-icons a:hover img {
  opacity: 0.65;
}

.share-icons .share-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  transition: none;
  /* opacity handled on the image */
  -webkit-appearance: none;
  appearance: none;
}

.share-icons .share-copy-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity 0.2s ease;
}

.share-icons .share-copy-btn:hover img {
  opacity: 0.65;
}

/* ===== Responsive — Tablet ===== */
@media screen and (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }

  .button-container {
    gap: 20px;
  }

  .custom-button {
    min-width: 140px;
  }
}

/* ===== Responsive — Mobile (hamburger breakpoint) ===== */
@media screen and (max-width: 600px) {
  /* Show the hamburger button */
  .nav-toggle {
    display: flex;
  }

  /* Give the header a bit more bottom breathing room for the toggle to sit below */
  header {
    padding: 28px 0 24px;
  }

  /* Logo / title scale */
  .header-logo {
    height: 2rem;
  }

  header h1 {
    font-size: 1.75rem;
  }

  /* Hide nav by default; show as a full-width drawer when open */
  nav {
    display: none;
    border-bottom: none;
    border-top: 1px solid #ddd;
  }

  nav.nav-open {
    display: block;
  }

  /* Stack nav items vertically */
  nav ul {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 8px 0;
  }

  nav ul li a,
  nav ul li button.share-btn {
    padding: 13px 20px;
    font-size: 1rem;
    border-bottom: 1px solid #eee;
    width: 100%;
    text-align: left;
  }

  nav ul li:last-child a,
  nav ul li:last-child button.share-btn {
    border-bottom: none;
  }

  /* Active indicator: left border instead of bottom border on mobile */
  nav ul li a.active {
    border-bottom: 1px solid #eee;
    border-left: 3px solid #555;
    padding-left: 17px; /* compensate for border */
    color: #000;
  }

  /* Dropdown: static/relative on mobile, no absolute positioning */
  nav ul li ul.dropdown {
    display: none;
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background-color: #f0f0f0;
    padding: 0;
    min-width: unset;
  }

  nav ul li ul.dropdown.open {
    display: flex;
  }

  nav ul li ul.dropdown li a {
    padding: 11px 20px 11px 32px;
    font-size: 0.9rem;
    border-bottom: 1px solid #e5e5e5;
    color: #555;
  }

  nav ul li ul.dropdown li:last-child a {
    border-bottom: none;
  }

  /* Button grid: two per row on small phones */
  .button-container {
    gap: 14px;
  }

  .custom-button {
    flex: 0 1 calc(50% - 7px);
    max-width: calc(50% - 7px);
    min-width: 130px;
  }

  /* Main content spacing */
  main {
    padding: 24px 0;
  }

  main h2 {
    font-size: 1.3rem;
    margin-top: 0;
  }

  /* Form: full-width on mobile */
  main form {
    max-width: 100%;
  }

  /* Blockquotes: tighten padding on small screens */
  main figure {
    padding: 16px 14px 12px;
  }
}

/* ===== Responsive — Very small phones ===== */
@media screen and (max-width: 380px) {
  body {
    padding: 0 12px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .header-logo {
    height: 1.75rem;
  }

  /* Single column buttons on very small screens */
  .custom-button {
    flex: 0 1 calc(50% - 6px);
    max-width: calc(50% - 6px);
    min-width: 120px;
  }

  .button-image {
    padding: 20px;
  }
}
