/*
 * Theme and styles for the Wisdom to Live By promotional website
 *
 * This CSS defines a clean, modern aesthetic with a limited color palette
 * inspired by the book’s cover design.  Variables at the top of the file
 * allow easy adjustment of colors and spacing.  The layout uses flexbox
 * and CSS grid to remain responsive across a variety of screen sizes.
 */

/* Color system defined using CSS custom properties.  The values here
   correspond to the Pantone–inspired palette described in the book’s
   design guide (deep teal, coral orange and golden yellow).  A dark
   theme is available by toggling a class on the body element; see
   script.js for implementation details. */
:root {
  --primary-color: #005c5c;      /* deep teal */
  --secondary-color: #f26e56;    /* coral orange */
  --accent-color: #fcd116;       /* golden yellow */
  --neutral-light: #ffffff;      /* base light background */
  --neutral-dark: #101010;       /* base dark background */
  --text-color: #222222;         /* primary text color */
  --text-muted: #555555;         /* secondary text color */
  --link-color: #006d6d;         /* link color derived from primary */
  --card-bg: #f7f7f7;            /* cards and panels */
  --border-radius: 8px;          /* global corner radius */
}

/* Dark mode overrides using the body.dark-mode class.  Colors are
   darkened to provide sufficient contrast.  Keep the palette
   consistent with the light mode to maintain brand recognition. */
body.dark-mode {
  --neutral-light: #0f1618;
  --neutral-dark: #ffffff;
  --text-color: #eaeaea;
  --text-muted: #999999;
  --link-color: #6ad9d9;
  --card-bg: #182022;
}

/* Global resets and typography settings */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--neutral-light);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  scroll-behavior: smooth;
}

img {
  max-width: 100%;
  display: block;
  height: auto;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--secondary-color);
}

/* Layout containers */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

header {
  background-color: var(--neutral-light);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Apply a subtle shadow when the header is scrolled */
header.scrolled {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  background-color: var(--neutral-light);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
}

.logo img {
  height: 50px;
  width: auto;
}

nav {
  display: flex;
  align-items: center;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

nav li a {
  font-weight: 600;
  position: relative;
}

nav li a::after {
  content: '';
  height: 2px;
  width: 0;
  position: absolute;
  bottom: -4px;
  left: 0;
  background-color: var(--secondary-color);
  transition: width 0.3s;
}

nav li a:hover::after,
nav li a:focus::after,
nav li a.active::after {
  width: 100%;
}

/* Hamburger menu for smaller screens */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background-color: var(--text-color);
  transition: transform 0.3s, opacity 0.3s;
}

/* Mobile navigation styles */
@media (max-width: 768px) {
  nav {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--neutral-light);
    width: 200px;
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.3s ease;
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.1);
  }
  nav.open {
    transform: scaleY(1);
  }
  nav ul {
    flex-direction: column;
    padding: 1rem;
  }
  nav li {
    margin-bottom: 0.75rem;
  }
  nav li:last-child {
    margin-bottom: 0;
  }
  .hamburger {
    display: flex;
  }
}

/* Hero section */
.hero {
  position: relative;
  width: 100%;
  height: 75vh;
  background-image: url('images/hero.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--neutral-light);
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.7) 100%);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: 0.5rem;
  line-height: 1.2;
  color: #fff;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  margin-bottom: 1.5rem;
  color: #f5f5f5;
}

.btn {
  display: inline-block;
  background-color: var(--secondary-color);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.btn:hover {
  background-color: var(--primary-color);
}

/* Section styling */
section {
  padding: 4rem 0;
}

section:nth-of-type(even) {
  background-color: var(--card-bg);
}

section h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--primary-color);
}

section p {
  max-width: 800px;
  margin: 0 auto;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.feature {
  background-color: var(--neutral-light);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature:hover {
  transform: translateY(-6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature h3 {
  margin-bottom: 0.75rem;
  color: var(--secondary-color);
  font-size: 1.25rem;
}

.feature p {
  color: var(--text-color);
  font-size: 1rem;
}

.product-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
}

.product-img {
  flex: 1 1 300px;
  max-width: 400px;
}

.product-details {
  flex: 1 1 300px;
  max-width: 500px;
}

.product-details h3 {
  color: var(--primary-color);
  margin-bottom: 0.75rem;
}

.product-details p {
  margin-bottom: 1rem;
}

/* About page specific styling */
.about-author {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.about-author img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.about-author .bio {
  max-width: 800px;
  text-align: center;
}

/* Contact page styling */
.contact-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.contact-info {
  background-color: var(--neutral-light);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.contact-info h3 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.contact-info p {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.social-links {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
}

.social-links img {
  width: 32px;
  height: 32px;
  transition: transform 0.2s;
}

.social-links img:hover {
  transform: scale(1.1);
}

.contact-form {
  background-color: var(--neutral-light);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.contact-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-color);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: var(--border-radius);
  border: 1px solid #ccc;
  background-color: #fff;
  color: var(--text-color);
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(242, 110, 86, 0.2);
}

.contact-form button {
  background-color: var(--secondary-color);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.contact-form button:hover {
  background-color: var(--primary-color);
}

.contact-form .success-message {
  display: none;
  margin-top: 1rem;
  padding: 1rem;
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  border-radius: var(--border-radius);
}

/* Footer styling */
footer {
  background-color: var(--primary-color);
  color: #ffffff;
  padding: 2rem 0;
  text-align: center;
}

footer p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

footer .footer-nav {
  margin-bottom: 1rem;
}

footer .footer-nav a {
  margin: 0 0.75rem;
  color: #ffffff;
  font-weight: 500;
  transition: opacity 0.3s;
}

footer .footer-nav a:hover {
  opacity: 0.75;
}

footer .footer-social {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

footer .footer-social img {
  width: 28px;
  height: 28px;
  /* Do not invert colors for custom social icons; the icons are
     designed to match the site’s color palette */
  filter: none;
  transition: transform 0.2s;
}

footer .footer-social img:hover {
  transform: scale(1.1);
}

/* Layout for purchase links in the product section */
.purchase-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (min-width: 480px) {
  .purchase-links {
    flex-direction: row;
  }
}

/* Back to top button */
#backToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: var(--secondary-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  transition: opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
}

#backToTop.show {
  opacity: 1;
  pointer-events: all;
}

#backToTop svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

/* Animations for revealing elements on scroll */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Dark mode toggle button */
.theme-toggle {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: transform 0.3s ease;
}

.theme-toggle:hover {
  transform: rotate(20deg);
}