:root {
  /* Hero styles */
  --hero-font: 'Cormorant Garamond', serif;
  --hero-size: 3.5rem;
  --hero-colour: #7a0000;

  /* Invite styles */
  --invite-font: 'Cormorant Garamond', serif;
  --invite-size: 1.5rem;
  --invite-colour: #7a0000;

  /* Intro styles */
  --intro-font: 'Cormorant Garamond', serif;
  --intro-size: 1.3rem;
  --intro-colour: #6c3422;

  /* Heading styles */
  --headings-font: 'Cormorant Garamond', serif;
  --headings-size: 2rem;
  --headings-colour: #7a0000;

  /* Menu styles */
  --menu-font: 'Cormorant Garamond', serif;
  --menu-size: 1.5rem;
  --menu-colour: #6c3422;
  --menu-hover-colour: #7a0000;

  /* Body styles */
  --body-font: 'Cormorant Garamond', serif;
  --body-size: 1.3rem;
  --body-colour: #6c3422;

  /* Link styles */
  --links-colour: #973810;
  --links-hover-colour: #7a0000;

  /* Accent colour */
  --accent-colour: #973810;

  /* Background images */
  --bg-top-right: url('/static/images/bg-top-right.png');
  --bg-bottom-left: url('/static/images/bg-bottom-left.png');
}

/* Reset and base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--body-font);
  font-size: var(--body-size);
  color: var(--body-colour);
  line-height: 1.6;
  min-height: 100vh;
  background-color: #fffef9;
}

/* Background decorations */
.bg-decoration {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  background-repeat: no-repeat;
  background-size: contain;
}

.bg-top-right {
  top: 0;
  right: 0;
  width: 450px;
  height: 640px;
  background-image: var(--bg-top-right);
  background-position: top right;
  z-index: 101;
}

.bg-bottom-left {
  bottom: 0;
  left: 0;
  width: 790px;
  height: 480px;
  background-image: var(--bg-bottom-left);
  background-position: bottom left;
}

/* Site wrapper - flexbox layout */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top navigation */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

.topnav-content {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
}

/* Navigation menu */
.nav-menu {
  list-style: none;
  display: flex;
  gap: 0.5rem;
}

.nav-item {
  margin: 0;
}

.nav-link {
  display: block;
  padding: 0.5rem 1rem;
  font-family: var(--menu-font);
  font-size: var(--menu-size);
  color: var(--menu-colour);
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--menu-hover-colour);
  background-color: rgba(122, 0, 0, 0.05);
}

/* Sign out button styled as a menu link */
.nav-button {
  width: 100%;
  margin: 0;
  background: none;
  border: 0;
  cursor: pointer;
  appearance: none;
  line-height: inherit;
  font-weight: inherit;
  font-style: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: inherit;
  vertical-align: baseline;
}

.nav-item form {
  display: block;
  margin: 0;
}

/* Buttons */
.button {
  display: inline-block;
  padding: 0.6rem 1.8rem;
  font-family: var(--menu-font);
  font-size: var(--menu-size);
  color: #fff;
  background-color: var(--menu-hover-colour);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.button:hover {
  opacity: 0.85;
}

/* Status pages (waiting for approval, not approved) */
.status-page {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  font-family: var(--intro-font);
  font-size: var(--intro-size);
  color: var(--intro-colour);
}

.status-page h1 {
  margin-bottom: 1rem;
  color: var(--menu-hover-colour);
}

.status-page p {
  margin-bottom: 1.5rem;
}

/* Menu toggle button - hidden on desktop */
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--accent-colour);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--menu-colour);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger animation when open */
.topnav.is-open .hamburger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.topnav.is-open .hamburger span:nth-child(2) {
  opacity: 0;
}

.topnav.is-open .hamburger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Main content area */
.content {
  margin-top: 70px; /* Account for fixed top nav height */
  padding: 3rem 2rem;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 70px);
}

.content > * {
  text-align: center;
  width: 100%;
  max-width: 700px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--headings-font);
  color: var(--headings-colour);
  line-height: 1.3;
  margin-bottom: 1rem;
}

h1 {
  font-size: var(--headings-size);
}

h2 {
  font-size: calc(var(--headings-size) * 0.85);
}

h3 {
  font-size: calc(var(--headings-size) * 0.7);
}

p {
  margin-bottom: 1rem;
}

/* Lists - center the list block while keeping text left-aligned */
ul, ol {
  display: inline-block;
  text-align: left;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Links */
a {
  color: var(--links-colour);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--links-hover-colour);
}

/* Hero section (home page) */
.hero {
  text-align: center;
  padding: 4rem 2rem;
}

.hero-names {
  font-family: var(--hero-font);
  font-size: var(--hero-size);
  color: var(--hero-colour);
  font-weight: 400;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero-names-image {
  max-width: 100%;
  height: auto;
  margin-bottom: 1rem;
}

.hero-invite {
  font-family: var(--invite-font);
  font-size: var(--invite-size);
  color: var(--invite-colour);
  font-weight: 400;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.hero-date {
  font-family: var(--headings-font);
  font-size: 1.5rem;
  color: var(--headings-colour);
  font-weight: 300;
  margin-bottom: 2rem;
}

.hero-date-image {
  max-width: 50%;
  height: auto;
  margin-bottom: 2rem;
}

.hero-intro {
  max-width: 700px;
  margin: 0 auto;
  font-family: var(--intro-font);
  font-size: var(--intro-size);
  color: var(--intro-colour);
}

/* Home page sections */
.home-section {
  max-width: 700px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--accent-colour);
  font-family: var(--body-font);
  font-size: var(--body-size);
  color: var(--body-colour);
  overflow-wrap: break-word;
}

.home-section h2 {
  margin-bottom: 0.75rem;
  text-align: center;
}

.home-section p + p {
  margin-top: 0.75rem;
}

.home-steps {
  padding-left: 1.5rem;
}

.home-steps li + li {
  margin-top: 0.75rem;
}

.home-cta {
  text-align: center;
}

.home-cta .button {
  min-height: 44px;
  padding: 0.7rem 2.5rem;
  text-decoration: none;
}

.home-cta p {
  margin-top: 1rem;
}

/* Page content */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--accent-colour);
}

.page-title {
  margin-bottom: 0.5rem;
}

.page-content {
  line-height: 1.8;
}

/* Placeholder sections */
.placeholder {
  background: rgba(151, 56, 16, 0.05);
  border: 2px dashed var(--accent-colour);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  margin: 2rem 0;
}

.placeholder p {
  margin-bottom: 0;
  color: var(--body-colour);
  opacity: 0.8;
}

/* Mobile styles */
@media (max-width: 767px) {
  .topnav {
    position: static;
  }

  .menu-toggle {
    display: flex;
  }

  .topnav-content {
    flex-wrap: wrap;
    padding: 1rem;
  }

  .nav-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    padding-top: 1rem;
    gap: 0;
  }

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

  .nav-link {
    padding: 0.75rem 1rem;
    text-align: center;
  }

  .content {
    margin-top: 0;
    padding: 2rem 1.5rem;
  }

  .hero {
    padding: 2rem 1rem;
  }

  .hero-names {
    font-size: calc(var(--hero-size) * 0.7);
  }

  .hero-date {
    font-size: 1.2rem;
  }

  .bg-top-right {
    width: 180px;
    height: 255px;
  }

  .bg-bottom-left {
    width: 300px;
    height: 190px;
  }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
  .topnav-content {
    padding: 1rem 1.5rem;
  }

  .content {
    padding: 2rem;
  }
}

/* Shared form styles */
.form-page h1 {
  margin-bottom: 1.5rem;
}

.form {
  text-align: left;
  margin-bottom: 1.5rem;
}

.form-field {
  margin-bottom: 1.2rem;
}

.form label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: var(--body-size);
  color: var(--body-colour);
}

.form input[type="text"],
.form input[type="email"],
.form input[type="password"] {
  display: block;
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: var(--body-font);
  font-size: 1.2rem; /* at least 16px so phones do not zoom on focus */
  color: var(--body-colour);
  background-color: #fff;
  border: 1px solid var(--accent-colour);
  border-radius: 4px;
}

.form input:focus {
  outline: 2px solid var(--menu-hover-colour);
  outline-offset: 1px;
}

.form-field-error input {
  border-color: var(--hero-colour);
}

.form-error {
  margin-top: 0.3rem;
  margin-bottom: 1rem;
  color: var(--hero-colour);
  font-weight: 600;
}

.form .button {
  width: 100%;
}

.form-alt {
  font-size: 1.1rem;
}

/* Admin screen */
.admin-page {
  max-width: 700px;
  margin: 0 auto;
  font-family: var(--intro-font);
  font-size: var(--intro-size);
  color: var(--intro-colour);
}

.admin-tabs ul {
  display: flex;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--accent-colour);
}

.admin-tabs li {
  flex: 1;
}

.admin-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-bottom: 4px solid transparent;
  font-family: var(--menu-font);
  font-size: var(--menu-size);
  color: var(--menu-colour);
  text-decoration: none;
}

.admin-tab:hover,
.admin-tab-current {
  color: var(--menu-hover-colour);
}

.admin-tab-current {
  border-bottom-color: var(--accent-colour);
  font-weight: 700;
}

.admin-page h1 {
  margin-bottom: 1rem;
  text-align: center;
  color: var(--menu-hover-colour);
}

.admin-note {
  font-size: 1rem;
}

.admin-list {
  list-style: none;
  padding: 0;
}

.admin-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--accent-colour);
}

.admin-who span,
.admin-who strong {
  display: block;
  overflow-wrap: anywhere;
}

.admin-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.admin-actions form {
  flex: 1;
}

.admin-actions .button {
  width: 100%;
}

.button-secondary {
  background-color: transparent;
  color: var(--menu-hover-colour);
  border: 1px solid var(--menu-hover-colour);
}

/* Secondary button under a form's main button */
.form .button-secondary {
  margin-top: 0.5rem;
}

/* Album list and gallery */
.album-list-section,
.gallery-page,
.orders-page {
  max-width: 900px;
  margin: 2rem auto 0;
  font-family: var(--intro-font);
  font-size: var(--intro-size);
  color: var(--intro-colour);
}

.album-list-section h1,
.gallery-page h1,
.orders-page h1 {
  margin-bottom: 1rem;
  text-align: center;
  color: var(--menu-hover-colour);
}

.album-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.album-list li {
  display: flex;
}

.album-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  flex: 1;
  align-content: flex-start;
  padding: 1rem;
  border: 1px solid var(--accent-colour);
  color: var(--links-colour);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.album-cover {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  margin-bottom: 0.5rem;
}

.album-card:hover {
  color: var(--links-hover-colour);
}

.album-count,
.gallery-count {
  font-size: 1rem;
}

.gallery-count {
  margin-top: -0.5rem;
  text-align: center;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.gallery li {
  aspect-ratio: 1;
}

.gallery a,
.gallery img {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery img {
  object-fit: cover;
}

.gallery-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
}

.gallery-pager a,
.gallery-back a {
  color: var(--links-colour);
}

.gallery-back {
  text-align: center;
}

@media (min-width: 600px) {
  .album-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .album-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }
}

/* Single photo view */
.photo-page {
  max-width: 900px;
  margin: 2rem auto 0;
  font-family: var(--intro-font);
  font-size: var(--intro-size);
  color: var(--intro-colour);
  text-align: center;
}

.photo-page h1 {
  margin-bottom: 1rem;
  color: var(--menu-hover-colour);
  overflow-wrap: anywhere;
}

.photo-view {
  margin: 0 0 1rem;
}

.photo-view img {
  max-width: 100%;
  max-height: calc(100vh - 10rem);
  max-height: calc(100dvh - 10rem);
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Fixed centre-crop print preview. Set aspect-ratio inline per element. */
.print-preview {
  box-sizing: border-box;
  max-width: 100%;
  margin: 0 auto 1rem;
  overflow: hidden;
  border: 1px solid var(--accent-colour);
}

.print-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.print-preview-small {
  width: 8rem;
  margin: 0;
}

.cover-choice {
  margin: 0 0 1rem;
}

.cover-choice p,
.cover-choice form {
  margin: 0;
}

.add-to-basket {
  margin: 1.5rem 0;
}

.add-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0 auto 1rem;
  max-width: 20rem;
}

.print-preview-caption {
  text-align: center;
  margin: 0 0 1rem;
}

.basket-notice {
  font-weight: bold;
}

.photo-back a {
  color: var(--links-colour);
}

/* Basket page */
.basket-total {
  font-weight: bold;
}

.basket-warning {
  color: #a00;
}

.basket-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

.basket-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--accent-colour);
}

.basket-line-info {
  display: flex;
  flex: 1 1 10rem;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.basket-line-info a {
  color: var(--links-colour);
}

/* Basket line controls */
.basket-line-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.basket-control {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  max-width: 100%;
}

.basket-control label {
  min-width: 4.5rem; /* fields line up down the stack of controls */
}

.basket-control select {
  min-width: 0;
  max-width: 100%;
}

.basket-control select,
.basket-control input[type="number"] {
  min-height: 2.75rem;
  padding: 0.4rem 0.6rem;
  font-family: var(--body-font);
  font-size: 1.2rem; /* at least 16px so phones do not zoom on focus */
  color: var(--body-colour);
  background-color: #fff;
  border: 1px solid var(--accent-colour);
  border-radius: 4px;
}

.basket-control input[type="number"] {
  width: 5rem;
}

.basket-control select,
.basket-control input[type="number"],
.basket-control .button {
  box-sizing: border-box;
  line-height: 1.2;
}

.basket-control .button {
  min-height: 2.75rem;
  padding: 0.4rem 1rem;
  font-size: 1.2rem;
}

/* My orders page */
.orders {
  list-style: none;
  margin: 0;
  padding: 0;
}

.order {
  padding: 1rem;
  margin-bottom: 1rem;
  min-width: 0;
  overflow-wrap: anywhere;
  border: 1px solid var(--accent-colour);
}

.orders-page .orders,
.orders-page .basket-lines {
  display: block;
  width: 100%;
  text-align: left;
}

.orders-page .order-header {
  padding-bottom: 0.5rem;
}

.orders-page .order-status {
  margin-left: auto;
}

.orders-page .order-note {
  margin-bottom: 0.5rem;
}

/* Full-width dividers between header, prints and total */
.orders-page .basket-line {
  border-bottom: 0;
  border-top: 1px solid var(--accent-colour);
}

.orders-page .order-total {
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--accent-colour);
}

.orders-page .order-thanks,
.orders-page > p {
  text-align: center;
}

.order-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
}

.order-header h2 {
  margin: 0;
}

.order-status {
  font-weight: bold;
}

.order-note {
  font-style: italic;
}

.order-total {
  font-weight: bold;
}

.place-order {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.place-order h2 {
  text-align: center;
}

.place-order label {
  text-align: left;
  font-size: var(--body-size);
  color: var(--body-colour);
}

.place-order textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 0.8rem;
  font-family: var(--body-font);
  font-size: 1.2rem;
  color: var(--body-colour);
  background-color: #fff;
  border: 1px solid var(--accent-colour);
  border-radius: 4px;
  resize: vertical;
}

.place-order .button {
  width: 100%;
  box-sizing: border-box;
}

.order-thanks {
  font-weight: bold;
}

/* Admin order pages */
.admin-order-note {
  white-space: pre-line;
  font-style: italic;
  overflow-wrap: anywhere;
}

.admin-prints .basket-line-info span {
  display: block;
  overflow-wrap: anywhere;
}

.admin-printed {
  font-weight: bold;
}
