/* -------------------------------------------------------------
   Book Haven Bookstore – Global Stylesheet (style.css)
   ------------------------------------------------------------- */

/* ============ 1.  Brand Palette & Primitives ============ */
:root {
  /* Core palette used across all pages */
  --inkwell-blue:      #2e4057;
  --parchment-white:   #fff7ee;
  --aged-gold:         #c7b65e;
  --dusty-rose:        #f7b3cc;
  --intensity-indigo:  #ee583f;
  --bookish-black:     #131c26;

  /* Typography */
  --font-heading: Arial, Helvetica, sans-serif;
  --font-subtitle: "Comfortaa", Arial, Helvetica, sans-serif;
  --font-body: Calibri, "Segoe UI", Roboto, sans-serif;

  /* Measures */
  --page-max: 1200px;
}

/* ============ 2.  CSS Reset / Base ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--bookish-black);
  background: var(--parchment-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* Visually hidden but accessible text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--inkwell-blue);
  text-decoration: none;
}

.container {
  /* centers content and limits page width */
  width: min(90%, var(--page-max));
  margin-inline: auto;
}

/* ============ 3.  Header & Navigation ============ */
header {
  background: var(--dusty-rose);
  padding-block: 0.5rem 0.75rem;
}

.nav-wrapper {
  display: flex;
  align-items: flex-start;  /* align logo to top */
  justify-content: flex-start; /* items arranged left-to-right */
  flex-wrap: nowrap;           /* keep items on one line */
}

/* Logo + word‑mark */
.logo {
  display: flex;
  align-items: flex-start;   /* word‑mark aligns with top of logo */
  margin-right: auto;        /* push menu and burger to the right */
}

.logo img {
  max-height: 64px;          /* cap header height */
  width: auto;
  height: auto;
}

.logo-wordmark {
  font-family: var(--font-subtitle);
  font-weight: 700;
  margin-left: 0.5rem;
  color: var(--bookish-black);
  white-space: nowrap;
  font-size: clamp(1rem, 4vw, 1.25rem);
}

/* Primary nav list */
#nav-menu {
  display: flex;
  gap: 2rem;
}

#nav-menu a {
  position: relative;
  font-family: var(--font-heading);
  font-weight: 700;
  padding-block: 0.25rem;
}

#nav-menu a.active::after,
#nav-menu a:hover::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--aged-gold);
}

/* ============ 4.  Hamburger (mobile only) ============ */
#nav-toggle {
  order: 2;                 /* stays far right */
  display: block;            /* shown <640px */
  background: transparent;
  border: 0;
  padding: 0.25rem;
  cursor: pointer;
}

#nav-toggle .bar {
  display: block;
  width: 24px;
  height: 3px;
  margin: 4px 0;
  background: var(--bookish-black);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#nav-toggle[aria-expanded="true"] .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
#nav-toggle[aria-expanded="true"] .bar:nth-child(2) {
  opacity: 0;
}
#nav-toggle[aria-expanded="true"] .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============ 5.  Hero Carousel ============ */
.hero {
  /* container for rotating promotional imagery */
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 320px;
  padding-block-start: 0; /* pull carousel up toward its heading */
}

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.slide.active {
  opacity: 1;
}

.slide img {
  object-fit: contain;
  width: auto;
  height: 100%;
}

.hero-title {
  text-align: center;
  margin-block-end: 0;
}
/* Previous/next buttons */
.hero button.prev,
.hero button.next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  font-size: 2rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  z-index: 10;
}
.hero button.prev { left: 0.5rem; }
.hero button.next { right: 0.5rem; }

/* Indicator dots */
.hero .indicators {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
}
.hero .indicators button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.6);
  padding: 0;
  cursor: pointer;
}
.hero .indicators button.active,
.hero .indicators button:hover {
  background: var(--aged-gold);
}

@media (min-width: 768px) {
  .hero { height: 420px; }
}

/* ============ 6.  Sections / Utilities ============ */
section {
  padding-block: 2.5rem;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  color: var(--inkwell-blue);
  line-height: 1.2;
  margin-block: 0 0.75rem;
}

h1 { font-size: clamp(1.6rem, 5vw, 2.25rem); }
h2 { font-size: clamp(1.3rem, 4vw, 1.75rem); }
h3 { font-size: clamp(1.1rem, 3vw, 1.35rem); }

/* Promo cards layout */
.promo-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.promo-card {
  background: var(--dusty-rose);
  padding: 1rem;
  text-align: center;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

/* Category cards layout */
.categories {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.category-card {
  display: block;
  text-align: center;
  font-family: var(--font-subtitle);
  color: var(--bookish-black);
}

.category-card img {
  border-radius: 4px;
  width: 100%;
  height: auto;
}

.category-card span {
  display: block;
  margin-top: 0.5rem;
  font-weight: 700;
}

/* Newsletter */
.newsletter {
  background: var(--inkwell-blue);
  color: var(--parchment-white);
  text-align: center;
  padding: 2rem 1rem;
}

.newsletter form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.newsletter input[type="email"] {
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  width: min(260px, 80%);
}

.newsletter button {
  padding: 0.5rem 1rem;
  font-family: var(--font-heading);
  font-weight: 700;
  background: var(--aged-gold);
  color: var(--bookish-black);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.newsletter button:hover {
  background: var(--intensity-indigo);
  color: var(--parchment-white);
}


/* ============ 7.  Footer ============ */
footer {
  background: var(--dusty-rose);
  padding-block: 1.5rem;
  text-align: center;
  font-family: var(--font-subtitle);
}

footer .socials {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
}

footer .socials a {
  font-size: 1.25rem;
  color: var(--inkwell-blue);
}

/* ============ 8.  Responsive Breakpoints ============ */

/* Mobile first: hide desktop nav, show burger */
#nav-menu {
  order: 1;                 /* place menu left of burger */
  display: none;
  flex-direction: column;
  gap: 1rem;
  margin-right: 1rem;       /* breathing room from burger */
  width: auto;              /* don't stretch full width */
}

#nav-menu.open {
  display: flex;
}

@media (min-width: 640px) {
  /* desktop / tablet */
  .nav-wrapper {
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
  }
  .logo {
    margin-right: 0;         /* reset auto margin */
  }
  #nav-toggle {
    display: none;
  }

  #nav-menu {
    display: flex !important;
    flex-direction: row;
    gap: 2rem;
    margin-top: 0;
    margin-right: 0;
    width: auto;
    order: 0;
  }
}

/* Taller hero on large screens */
@media (min-width: 1200px) {
  .hero { height: 500px; }
}

/* Optional: hide word‑mark on ultra‑small phones */
@media (max-width: 375px) {
  .logo-wordmark {
    display: none;
  }
}

/* ============ 9.  Gallery Page ============ */
.product-table {
  /* layout for gallery items */
  width: min(100%, 1000px);
  margin: 1rem auto;
  border-collapse: collapse;
  table-layout: fixed;        /* equal column widths */
}

.product-table tbody {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.product-table tr {
  display: contents;
}
.product-table td {
  padding: 1rem;
  text-align: center;
  vertical-align: top;
}
.product-table img {
  display: block;
  margin-inline: auto;        /* center horizontally */
  width: 500px;               /* match image dimensions */
  max-width: 100%;
  height: auto;
}
.product-table button {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--aged-gold);
  border: none;
  cursor: pointer;
  font-family: var(--font-heading);
}

@media (max-width: 639px) {
  .product-table tbody {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .product-table tbody {
    grid-template-columns: repeat(2, 1fr);
  }
}



dialog#cart-modal {
  border: 1px solid var(--inkwell-blue);
  padding: 1rem;
}

/* ============ 10.  About Page ============ */
.contact-form {
  /* styling for about-page contact form */
  display: grid;
  gap: 0.75rem;
  max-width: 400px;
  margin: 1rem auto;
}

.contact-form label {
  display: block;
  font-weight: 700;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: var(--font-body);
}

.contact-form button {
  padding: 0.5rem 1rem;
  font-family: var(--font-heading);
  background: var(--aged-gold);
  border: none;
  cursor: pointer;
}
