/* Root Variables - Consolidated from both desktop and mobile versions */

:root {
  /* Layout Sizes */
  --dl-layout-size-large: 144px;
  --dl-layout-size-small: 48px;
  --dl-layout-space-unit: 16px;
  --dl-layout-size-medium: 96px;
  --dl-layout-size-xlarge: 192px;
  --dl-layout-size-xsmall: 16px;
  --dl-layout-size-xxlarge: 288px;
  --dl-layout-size-maxwidth: 1400px;

  /* Colors */
  --dl-color-default-beige: rgb(247 245 243 / 100%);
  --dl-color-default-white: rgb(255 255 255 / 100%);
  --dl-color-default-grey: rgb(245 245 245 / 100%);
  --dl-color-default-dark80: rgb(194 197 206 / 100%);
  --dl-color-default-dark90: rgb(102 111 141 / 100%);
  --dl-color-default-dark100: rgb(25 33 61 / 100%);
  --dl-color-default-grey500: rgb(102 112 133 / 100%);
  --dl-color-default-grey900: rgb(16 24 40 / 100%);
  --dl-color-default-primary: rgb(245 118 0 / 100%);
  --dl-color-default-secondary: rgb(0 180 197 / 100%);
  --dl-color-theme-accent1: #fff;
  --dl-color-theme-accent2: #f5d1b0;
  --dl-color-theme-primary1: #bf4408;
  --dl-color-theme-primary2: #e65103;
  --dl-color-theme-secondary1: #fff;
  --dl-color-theme-secondary2: #fbf1eb;
  --dl-color-theme-neutral-dark: #191818;
  --dl-color-theme-neutral-light: #fbfaf9;

  /* Radius */
  --dl-layout-radius-round: 50%;
  --dl-layout-radius-cardradius: 8px;
  --dl-layout-radius-imageradius: 8px;
  --dl-layout-radius-inputradius: 24px;
  --dl-layout-radius-buttonradius: 24px;
  --dl-layout-radius-radius2: 2px;
  --dl-layout-radius-radius4: 4px;
  --dl-layout-radius-radius8: 8px;

  /* Spacing */
  --dl-layout-space-halfunit: 8px;
  --dl-layout-space-oneandhalfunits: 24px;
  --dl-layout-space-twounits: 32px;
  --dl-layout-space-threeunits: 48px;
  --dl-layout-space-fourunits: 64px;
  --dl-layout-space-fiveunits: 80px;
  --dl-layout-space-sixunits: 96px;
}

/* Base CSS Architecture - Set font family once at root level */
* {
  font-family: Inter, sans-serif;
}

/* Base Button Class - 99% of button styling */
.button {
  gap: 8px;
  height: 48px;
  display: flex;
  padding: 16px 24px;
  border: none;
  cursor: pointer;
  align-items: center;
  flex-shrink: 0;
  border-radius: 8px;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
  text-decoration: none;
  transition: 0.3s;
  white-space: nowrap;
}

/* Button Semantic Modifiers */
.button.primary {
  color: var(--dl-color-default-white);
  background-color: var(--dl-color-default-secondary);
}

.button.primary:hover {
  background-color: var(--dl-color-default-primary);
}

.button.secondary {
  color: var(--dl-color-default-white);
  background-color: var(--dl-color-default-dark80);
}

.button.accent {
  color: var(--dl-color-default-white);
  background-color: var(--dl-color-default-primary);
}

.button.large {
  height: 56px;
  padding: 16px 28px;
  font-size: 18px;
}

/* Icon styling */
.icon {
  width: 24px;
  height: 24px;
}

/* Button Icons */
.button .icon {
  width: 24px;
  height: 24px;
}

/* Base Input Class */
.input {
  height: 48px;
  display: flex;
  padding: 12px 16px;
  align-items: center;
  border: 1px solid var(--dl-color-default-dark80);
  border-radius: 8px;
  background-color: var(--dl-color-default-white);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
}

.input.large {
  height: 140px;
  padding: 12px;
  background-color: var(--dl-color-default-grey);
  border: none;
}

/* Base Text Classes */
.text.title {
  color: var(--dl-color-default-dark100);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  margin: 0;
}

.text.subtitle {
  color: var(--dl-color-default-dark90);
  font-size: 18px;
  font-weight: 400;
  line-height: 24px;
  text-align: left;
  margin: 0;
}

.text.section-title {
  color: var(--dl-color-default-dark100);
  font-size: 22px;
  font-weight: 700;
  line-height: 28px;
}

.text.body {
  color: var(--dl-color-default-dark90);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
}

.width-100 {
  width: 100%;
}

/* Layout Utility Classes */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.margin-16 { margin: 16px 0; }
.margin-24 { margin: 24px 0; }

.flex-column {
  display: flex;
  flex-direction: column;
}

/* Memory Page Specific Styles */
.memory-photo {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 10%);
}

.photo-frame {
  background: white;
  padding: 12px;
  border: 1px solid #eee;
  box-shadow: 0 4px 8px rgb(0 0 0 / 5%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.photo-frame .memory-photo {
  box-shadow: none;
  display: block;
}

.divider {
  width: 100%;
  height: 1px;
  margin: 24px 0;
  opacity: 0.3;
}

.community-section {
  text-align: center;
}

.community-section .text.section-title {
  text-align: center;
  margin-bottom: 16px;
}

.community-section .text.body {
  text-align: center;
  margin: 0 auto;
}

.email-signup {
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 auto;
}

.email-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: none;
  box-sizing: border-box;
  color: var(--dl-color-default-dark60);
}

.footer-logo {
  width: 32px;
  height: 32px;
}

.text.small {
  color: var(--dl-color-default-dark60);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  text-align: center;
}

/* Legacy Button Class - for compatibility */
.old-button {
  color: var(--dl-color-theme-neutral-dark);
  display: inline-block;
  padding: 0.5rem 1rem;
  border-color: var(--dl-color-theme-neutral-dark);
  border-width: 1px;
  border-radius: 4px;
  background-color: var(--dl-color-theme-neutral-light);
}

/* Legacy input styling - removed duplicate */

.textarea {
  color: var(--dl-color-theme-neutral-dark);
  cursor: auto;
  padding: 0.5rem;
  border-color: var(--dl-color-theme-neutral-dark);
  border-width: 1px;
  border-radius: 4px;
  background-color: var(--dl-color-theme-neutral-light);
}

.thq-input {
  color: var(--dl-color-theme-neutral-dark);
  cursor: auto;
  outline: none;
  padding: 0.5rem 1rem;
  align-self: stretch;
  text-align: center;
  border-color: var(--dl-color-theme-neutral-dark);
  border-width: 1px;
  border-radius: var(--dl-layout-radius-inputradius);
  background-color: var(--dl-color-theme-neutral-light);
}

.thq-input:focus {
  outline: 1px solid var(--dl-color-theme-primary1);
}

.thq-button-filled {
  gap: var(--dl-layout-space-halfunit);
  fill: var(--dl-color-theme-secondary1);
  color: var(--dl-color-theme-secondary1);
  cursor: pointer;
  display: flex;
  transition: 0.3s;
  align-items: center;
  font-weight: bold;
  padding: var(--dl-layout-space-halfunit) var(--dl-layout-space-oneandhalfunits);
  white-space: nowrap;
  border-color: var(--dl-color-theme-primary1);
  border-width: 1px;
  border-radius: var(--dl-layout-radius-buttonradius);
  justify-content: center;
  background-color: var(--dl-color-theme-primary1);
}

.thq-button-filled:hover {
  fill: var(--dl-color-theme-secondary2);
  color: var(--dl-color-theme-secondary2);
  border-color: var(--dl-color-theme-primary2);
  background-color: var(--dl-color-theme-primary2);
}

.thq-button-outline {
  gap: var(--dl-layout-space-halfunit);
  fill: var(--dl-color-theme-primary1);
  color: var(--dl-color-theme-primary1);
  border: 1px solid;
  cursor: pointer;
  display: flex;
  transition: 0.3s;
  align-items: center;
  font-weight: bold;
  padding: var(--dl-layout-space-halfunit) var(--dl-layout-space-oneandhalfunits);
  white-space: nowrap;
  border-color: var(--dl-color-theme-primary1);
  border-radius: var(--dl-layout-radius-buttonradius);
  justify-content: center;
}

.thq-button-outline:hover {
  fill: var(--dl-color-theme-secondary2);
  color: var(--dl-color-theme-secondary2);
  border-color: var(--dl-color-theme-primary2);
  background-color: var(--dl-color-theme-primary2);
}

/* Main Layout Styles */
.container {
  width: 100%;
  display: flex;
  overflow: auto;
  min-height: 100vh;
  align-items: center;
  flex-direction: column;
  background-color: var(--dl-color-default-beige);
}

.main-content {
  width: 100%;
  height: 1024px;
  display: flex;
  overflow: hidden;
  position: relative;
  align-items: center;
  flex-shrink: 0;
  justify-content: center;
  background-color: var(--dl-color-default-beige);
}

.main-content.memory {
  height: auto;
}

.modal {
  gap: 24px;
  width: 639px;
  margin: auto;
  display: flex;
  padding: 24px;
  box-shadow: 0 8px 50px 0 rgb(195 177 162 / 25%);
  align-items: stretch;
  flex-shrink: 0;
  border-radius: 12px;
  flex-direction: column;
  justify-content: flex-start;
  background-color: var(--dl-color-default-white);
}

/* Make loading screen full-bleed and remove default modal chrome */
#loading-screen.modal {
  width: 100%;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
  position: static;
}

/* Header Section - Base styles before specific ones */
.header-section {
  gap: 24px;
  display: flex;
  padding: 12px 0;
  align-self: stretch;
  align-items: center;
  border-color: var(--dl-color-default-grey);
  border-style: solid;
  border-width: 0 0 1px;
  flex-direction: row;
  justify-content: flex-start;
}

.modal.memory {
  width: 580px;
  margin: 60px auto;
  padding: 32px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
}

.modal.memory .header-section {
  width: 100%;
  padding: 0;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.modal.memory .header-section .text {
  text-align: center;
}

.modal.memory .header-section .button {
  width: 220px;
  height: 56px;
}

.modal.memory .flex-center.width-100 {
  margin-bottom: 24px;
}

.modal.memory .button.large {
  width: 220px;
}

.modal.memory .divider {
  width: 355px;
  height: 1px;
  background-color: #eee;
  opacity: 1;
  margin: 0;
  margin-bottom: 24px;
}

.modal.memory .text.title {
  font-size: 24px;
}

.modal.memory .text.subtitle {
  font-size: 16px;
}

.modal.memory .text.section-title {
  font-size: 20px;
}

.modal.memory .text.body {
  line-height: 20px;
}

.modal.memory .text.small {
  line-height: 24px;
  color: var(--dl-color-default-dark90);
}

.modal.memory .community-section {
  width: 532px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.modal.memory .community-section .text.section-title,
.modal.memory .community-section .text.body {
  text-align: center;
  margin: 0;
}

.modal.memory .community-section .community-text {
  width: 484px;
}

.modal.memory .email-signup {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: 532px;
  margin: 0 auto;
  align-items: center;
  flex-direction: row;
  justify-content: flex-start;
  box-sizing: border-box;
}

.modal.memory .email-signup .flex-column {
  display: block;
}

.modal.memory .email-input {
  width: 100%;
  min-width: 0;
  background-color: #F5F5F5;
  border: none;
  padding: 10px 12px;
  box-sizing: border-box;
}

.modal.memory .community-section .button.accent {
  width: 220px;
  height: 48px;
  padding: 16px 32px;
  box-sizing: border-box;
}

.modal.memory .photo-section {
  width: 100%;
  text-align: center;
  margin-bottom: 24px;
}

.modal.memory .photo-frame .text.body {
  margin: 0;
  text-align: left;
  font-size: 18px;
  line-height: 28px;
}

.modal.memory .memory-photo {
  width: 524px;
  height: 392px;
  object-fit: cover;
}

.modal.memory .footer-link {
  font-style: italic;
  font-weight: 500;
  font-size: 18px;
  line-height: 28px;
  color: #7E4012;
}


.logo-container {
  gap: 8px;
  display: flex;
  align-items: center;
  flex-direction: column;
  flex-shrink: 0;
  min-width: 120px;
}

.logo-image {
  width: 72px;
  height: 73px;
}

.logo-text {
  color: rgb(126 64 18 / 100%);
  height: auto;
  font-size: 15px;
  align-self: stretch;
  font-style: normal;
  text-align: center;
  font-family: "Fredoka One", sans-serif;
  font-weight: 700;
  line-height: normal;
  font-stretch: normal;
  text-decoration: none;
}

.header-content {
  gap: 2px;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  justify-content: center;
  flex-grow: 1;
  width: 0;
}

.title {
  color: var(--dl-color-default-dark100);
  height: auto;
  font-size: 28px;
  font-style: normal;
  text-align: left;
  font-family: Inter, sans-serif;
  font-weight: 700;
  line-height: 1.3;
  font-stretch: normal;
  text-decoration: none;
  margin: 0;
}

.description {
  color: var(--dl-color-default-dark90);
  width: 488px;
  height: auto;
  font-size: 18px;
  font-style: normal;
  text-align: left;
  font-family: Inter, sans-serif;
  font-weight: 400;
  line-height: 24px;
  font-stretch: normal;
  text-decoration: none;
  margin: 0;
}

/* Upload Section */
.upload-section {
  gap: 8px;
  display: flex;
  align-self: stretch;
  align-items: flex-start;
  flex-direction: column;
}

.section-title {
  color: var(--dl-color-default-dark100);
  height: auto;
  flex-grow: 1;
  font-size: 22px;
  font-style: normal;
  text-align: left;
  font-family: Inter, sans-serif;
  font-weight: 700;
  line-height: 28px;
  font-stretch: normal;
  text-decoration: none;
}

.upload-box {
  gap: 12px;
  min-height: 120px;
  display: flex;
  align-self: stretch;
  align-items: center;
  flex-shrink: 0;
  padding: 16px;
  border-color: var(--dl-color-default-dark90);
  border-style: dashed;
  border-width: 2px;
  border-radius: 8px;
  justify-content: center;
  flex-direction: column;
}

.upload-button {
  gap: 8px;
  height: 48px;
  display: flex;
  padding: 16px 24px;
  border: none;
  cursor: pointer;
  overflow: hidden;
  align-items: center;
  flex-shrink: 0;
  border-radius: 8px;
  justify-content: center;
  background-color: var(--dl-color-default-secondary);
}

.upload-icon {
  width: 24px;
  height: 24px;
}

.upload-text {
  color: var(--dl-color-default-white);
  height: auto;
  font-size: 16px;
  font-style: normal;
  text-align: left;
  font-family: Inter, sans-serif;
  font-weight: 700;
  line-height: 20px;
  font-stretch: normal;
  text-decoration: none;
}

/* Caption Section */
.caption-section {
  gap: 8px;
  display: flex;
  align-self: stretch;
  align-items: flex-start;
  flex-direction: column;
}

.caption-header {
  display: flex;
  align-self: stretch;
  align-items: flex-start;
  flex-shrink: 0;
  justify-content: space-between;
}

.record-button {
  gap: 8px;
  height: 48px;
  display: flex;
  padding: 16px 24px;
  border: none;
  cursor: pointer;
  overflow: hidden;
  align-items: center;
  flex-shrink: 0;
  border-radius: 8px;
  justify-content: center;
  background-color: var(--dl-color-default-secondary);
}

.microphone-icon {
  width: 24px;
  height: 24px;
}

.record-text {
  color: var(--dl-color-default-white);
  height: auto;
  font-size: 16px;
  font-style: normal;
  text-align: left;
  font-family: Inter, sans-serif;
  font-weight: 700;
  line-height: 18px;
  font-stretch: normal;
  text-decoration: none;
}

.caption-input-container {
  gap: 4px;
  display: flex;
  padding: 4px;
  align-self: stretch;
  align-items: flex-start;
  border-radius: 8px;
  flex-direction: column;
  justify-content: center;
}

.caption-input {
  gap: 12px;
  height: 140px;
  display: flex;
  padding: 12px;
  overflow: hidden;
  align-self: stretch;
  align-items: flex-start;
  flex-shrink: 0;
  border-radius: 8px;
  background-color: var(--dl-color-default-grey);
}

.input-placeholder {
  width: 575px;
  height: 24px;
  display: flex;
  position: relative;
  flex-grow: 1;
  align-items: flex-start;
  flex-shrink: 1;
  color: var(--dl-color-default-dark90);
  font-size: 16px;
  font-style: normal;
  text-align: left;
  font-family: Inter, sans-serif;
  font-weight: 400;
  line-height: 24px;
  font-stretch: normal;
  text-decoration: none;
}

.create-button {
  gap: 12px;
  width: 259px;
  height: 56px;
  display: flex;
  margin: 16px auto 0;
  padding: 16px 28px;
  border: none;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 2px 0 rgb(16 24 40 / 5%);
  align-items: center;
  flex-shrink: 0;
  border-radius: 8px;
  justify-content: center;
  background-color: var(--dl-color-default-dark80);
}

.create-text {
  color: var(--dl-color-default-white);
  width: 200px;
  height: auto;
  font-size: 18px;
  align-self: center;
  font-style: normal;
  text-align: left;
  font-family: Inter, sans-serif;
  font-weight: 700;
  line-height: 20px;
  font-stretch: normal;
  text-decoration: none;
}

/* --- JS-driven UI styles --- */

/* Utility class to hide elements. Using !important to override any other display styles. */
.hidden {
  display: none !important;
}

/* Container for photo preview thumbnails */
#image-preview {
  display: grid;
  grid-template-columns: repeat(4, 130px);
  gap: 12px;
  justify-content: start;
  width: 556px;
  max-width: 100%;
  margin: 0 auto;
  align-self: stretch;
}

/* Style for individual photo preview thumbnails */
.thumbnail-container {
  position: relative;
  width: 130px;
  height: 130px;
}

.thumbnail {
  width: 130px;
  height: 130px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--dl-color-default-dark80);
}

.delete-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: rgba(0,0,0,0.6);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    line-height: 1;
}

.thumbnail-container:hover .delete-icon {
    opacity: 1;
}

/* Upload tile (Add more photos) as 130x130 grid item */
.upload-tile {
  width: 130px;
  height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 auto;
  border: 2px solid #F5F5F5;
  border-radius: 6px;
  background-color: var(--dl-color-default-grey);
  color: var(--dl-color-default-secondary);
  cursor: pointer;
  user-select: none;
  flex: none;
  order: 3;
  flex-grow: 0;

  /* Pin tile to 1st row, 4th column when shown (1–3 images selected) */
  grid-column: 4;
  grid-row: 1;
}

.upload-tile .icon {
  width: 24px;
  height: 24px;
  display: block;
  filter: invert(43%) sepia(67%) saturate(1010%) hue-rotate(142deg) brightness(92%) contrast(98%);
}

.upload-tile span {
  font-size: 14px;
  font-weight: 600;
}

/* Icon mask for upload tile to allow color control */
.icon-upload {
  display: inline-block;
  width: 24px;
  height: 24px;
  /* inherit the tile's text color so icon = --dl-color-default-secondary */
  background-color: currentColor;
  /* robust masking across browsers */
  -webkit-mask-image: url(../img/icon-upload.svg);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url(../img/icon-upload.svg);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

/* Pulsing shadow animation for the record button */
@keyframes pulse-shadow { 0% { box-shadow: 0 0 0 0 rgb(217 83 79 / 70%); } 70% { box-shadow: 0 0 0 10px rgb(217 83 79 / 0%); } 100% { box-shadow: 0 0 0 0 rgb(217 83 79 / 0%); } }

/* Class applied via JS to indicate recording is active */
#record-button.recording {
  background-color: #d9534f; /* Red color to indicate recording */
  animation: pulse-shadow 1.5s infinite;
}

/* Styling for the textarea to blend into the new design's input box */
.caption-input textarea {
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  resize: none;
  font-size: 16px;
  line-height: 24px;
  font-family: inherit;
  background-color: transparent;
  color: var(--dl-color-default-dark90);
}

.caption-input textarea:focus {
  outline: none; /* Removes browser default focus outline */
}

/* Responsive Design */
@media (width <= 767px) {
  .main-content {
    height: 100vh;
    align-items: flex-start;
    padding: 0 16px;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* Remove default body margin to prevent white gutters on mobile */
  html, body {
    margin: 0;
    background-color: var(--dl-color-default-beige);
  }
  
  .modal {
    gap: 12px;
    top: 20px;
    left: 16px;
    right: 16px;
    bottom: 20px;
    width: auto;
    padding: 16px;
    position: absolute;
    align-items: flex-start;
    flex-shrink: 0;
    border-radius: 12px;
    box-sizing: border-box;
    overflow-y: auto;
  }

  /* Memory page mobile fix: keep modal in flow and prevent clipping in Chrome */
  .modal.memory {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
    padding: 16px;
    margin: 16px 16px 0;
    overflow-x: hidden;
  }

  /* Memory page: allow content to extend container */
  .main-content.memory {
    height: auto;
    overflow: visible;
  }

  /* Memory page: make fixed-width children fluid on mobile to avoid horizontal overflow */
  
  .modal.memory .divider {
    width: 100%;
  }
  
  .modal.memory .community-section {
    width: 100%;
  }
  
  .modal.memory .community-section .community-text {
    width: 100%;
    font-size: 14px;
    line-height: 16px;
  }
  
  .modal.memory .email-signup {
    width: 100%;
  }
  .modal.memory #signup-submit {
    width: 100%;
    align-self: stretch;
  }
  /* no width rules for .cf-turnstile here to avoid “fat/full width” */

  .modal.memory .email-input {
    width: 100%;
  }

  .modal.memory .community-section .button.accent {
    width: 93px;
    font-size: 14px;
    line-height: 18px;
  }
  
  .modal.memory .header-section .button {
    width: 157px;
  }
  
  .modal.memory .memory-photo {
    width: 100%;
    height: auto;
  }

  /* Mobile label swap for community button */
  .modal.memory .email-signup .label-desktop {
    display: none;
  }

  .modal.memory .email-signup .label-mobile {
    display: inline !important;
  }

  /* Memory page mobile typography: align with Figma */
  .modal.memory .text.subtitle {
    font-size: 16px;
    line-height: 20px;
  }

  .modal.memory .text.section-title {
    font-size: 17px;
    line-height: 20px;
    width: 100%;
  }

  .modal.memory .photo-frame .text.body {
    font-size: 16px;
    line-height: 24px;
    color: var(--dl-color-default-dark100);
  }


  .modal.memory .text.small {
    font-size: 12px;
    line-height: 16px;
    color: var(--dl-color-default-dark90);
  }


  .modal.memory .button.large {
    font-size: 16px;
    line-height: 20px;
  }
  
  .header-section {
    gap: 12px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
  }
  
  .logo-container {
    gap: 12px;
    padding: 4px 0;
    align-items: center;
    flex-direction: column;
    justify-content: center;
  }
  
  .header-content {
    gap: 4px;
    width: auto;
    padding: 8px 0;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
  
  .title {
    font-size: 24px;
    text-align: center;
  }
  
  .subtitle {
    width: auto;
    font-size: 16px;
    text-align: center;
  }

  /* Ensure higher-specificity rule centers subtitle paragraph */
  .text.subtitle {
    text-align: center;
  }
  
  .section-title {
    font-size: 18px;
    line-height: 24px;
    width: 270px;
  }

  .upload-box {
    gap: 12px;
    min-height: 100px !important;
    padding: 16px;
    align-items: center;
    flex-shrink: 0;
    border-radius: 8px;
    justify-content: center;
    border-style: solid;
    border-width: 1px;
    box-sizing: border-box;
    flex-direction: column;
  }
  
  .upload-button {
    gap: 8px;
    height: 44px;
    padding: 16px 20px;
    align-items: center;
    flex-shrink: 0;
    border-radius: 8px;
  }
  
  .upload-icon {
    width: 16px;
    height: 16px;
  }
  
  .upload-text {
    font-size: 14px;
    line-height: 20px;
  }
  
  .caption-header {
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
    justify-content: space-between;
  }

  
  .record-button {
    gap: 8px;
    width: 44px;
    height: 44px;
    padding: 12px;
    align-items: center;
    flex-shrink: 0;
    border-radius: 8px;
    justify-content: center;
  }
  
  .record-text {
    display: none;
  }
  
  .microphone-icon {
    width: 16px;
    height: 16px;
  }
  
  .caption-input {
    gap: 8px;
    height: 80px;
    padding: 12px;
    align-items: flex-start;
    flex-shrink: 0;
    border-radius: 8px;
  }
  
  .input-placeholder {
    width: 294px;
    height: 48px;
  }

  /* Mobile adjustments for new elements */
  .caption-input textarea {
    font-size: 16px;
    line-height: 24px;
  }

  #image-preview {
    grid-template-columns: repeat(2, 130px);
    width: 272px;
    margin: 0 auto;
    justify-content: center;
  }

  .upload-tile {
    grid-column: auto;
    grid-row: auto;
  }

  .thumbnail {
    width: 130px;
    height: 130px;
  }
  
  .create-button {
    gap: 12px;
    padding: 16px 28px;
    align-self: stretch;
    box-shadow: 0 1px 2px 0 rgb(16 24 40 / 5%);
    align-items: center;
    flex-shrink: 0;
    border-radius: 8px;
  }
  
  .create-text {
    font-size: 16px;
    line-height: 20px;
  }
}

@media (width <= 479px) {
  .upload-box {
    min-height: 100px;
    padding: 16px;
    border-style: dashed;
    border-width: 1px;
    justify-content: center;
  }
  
  .caption-input {
    height: 100px;
  }
  
  .input-placeholder {
    font-size: 16px;
    line-height: 24px;
  }
}

/* 404 Page Styles */
.not-found-container {
  width: 100%;
  display: flex;
  overflow: auto;
  min-height: 100vh;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  background-color: var(--dl-color-default-beige);
}

.not-found-code {
  display: flex;
  position: relative;
  align-items: center;
  flex-direction: column;
  justify-content: center;
}

.not-found-text {
  color: rgb(38 38 38);
  font-size: 252px;
  margin-top: -20px;
  font-weight: 900;
  margin-bottom: -20px;
  letter-spacing: -20px;
  font-family: Inter, sans-serif;
}

.not-found-message {
  width: 421px;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
}

.not-found-description {
  text-align: center;
  font-weight: 400;
  color: rgb(38 38 38);
}

.not-found-container h3 {
  color: rgb(38 38 38);
  font-weight: 400;
  text-align: center;
}

/* Processing Page Styles - Updated with cascading architecture */
.processing-container {
  width: 100%;
  display: flex;
  overflow: auto;
  min-height: 100vh;
  align-items: center;
  flex-direction: column;
  background-color: var(--dl-color-default-beige);
}

.processing-content {
  width: 100%;
  height: 100vh;
  display: flex;
  overflow: hidden;
  position: relative;
  align-items: flex-start;
  flex-shrink: 0;
  background-color: var(--dl-color-default-beige);
}

.processing-modal {
  gap: 24px;
  top: 45%;
  left: 0;
  right: 0;
  width: 357px;
  margin: auto;
  display: flex;
  padding: 32px;
  position: absolute;
  box-shadow: 0 8px 50px 0 rgb(195 177 162 / 25%);
  align-items: flex-start;
  border-radius: 12px;
  flex-direction: column;
  justify-content: center;
  background-color: rgb(255 255 255 / 100%);
}

.processing-text {
  gap: 12px;
  width: 100%;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
}

.processing-message {
  animation: pulse 2s ease-in-out infinite;
  color: var(--dl-color-default-dark100);
  height: auto;
  font-size: 20px;
  font-style: normal;
  text-align: center;
  font-weight: 700;
  line-height: 28px;
  font-stretch: normal;
  text-decoration: none;
}

.processing-progress {
  gap: 12px;
  width: 100%;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
}

.processing-progressbar {
  width: 356px;
  height: 8px;
  display: flex;
  position: relative;
  align-items: flex-start;
  flex-shrink: 1;
  border-radius: var(--dl-layout-radius-radius4);
  background-color: rgb(245 245 245 / 100%);
}

.processing-progress-image {
  top: 0;
  left: 0.5px;
  width: 104px;
  height: 8px;
  position: absolute;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--dl-color-default-secondary), var(--dl-color-default-primary));
  animation: progress-bar-fill 3s ease-in-out infinite;
}

/* Processing Animations */
@keyframes progress-bar-fill {
  0% {
    width: 0%;
  }

  100% {
    width: 100%;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

@keyframes progress-bar-fill-mobile {
  0% {
    width: 0;
  }

  100% {
    width: 100%;
  }
}

/* Mobile styles for processing page */
@media (width <= 767px) {
  .processing-content {
    height: 844px;
  }
  
  .processing-modal {
    top: 50%;
    left: 16px;
    right: 16px;
    width: auto;
    padding: 24px;
    transform: translateY(-50%);
  }
  
  .processing-progressbar {
    width: calc(100% - 32px);
  }
  
  .processing-progress-image {
    animation: progress-bar-fill-mobile 3s ease-in-out infinite;
  }
  
  .processing-message {
    font-size: 18px;
    line-height: 24px;
  }
}

@media (width <= 479px) {
  .processing-modal {
    top: 50%;
    padding: 20px;
    transform: translateY(-50%);
  }
  
  .processing-progressbar {
    width: calc(100% - 24px);
  }
  
  .processing-message {
    font-size: 16px;
    line-height: 22px;
  }
  
  /* Memory page mobile overrides */
  .email-signup {
    flex-direction: column;
    gap: 12px;
  }
  
  .email-input {
    width: 100%;
    min-width: auto;
  }
  
  .text.title {
    font-size: 24px;
  }
  
  .text.subtitle {
    font-size: 16px;
    line-height: 22px;
  }
  
  .text.section-title {
    font-size: 20px;
    line-height: 26px;
  }
}

/* Memory Page Specific Layouts - reusing existing button/input styles */
.action-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 16px 0;
}

.photos-container {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.photo-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-background {
  width: 388px;
  height: 300px;
  border-radius: 8px;
}

.photo-image {
  position: absolute;
  width: 350px;
  height: 260px;
  object-fit: cover;
  border-radius: 8px;
}

.photo-controls {
  position: absolute;
  top: 10px;
  right: 10px;
}

.control-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.control-icon {
  width: 16px;
  height: 16px;
}

.photo-caption {
  text-align: center;
  margin: 16px 0;
}

.caption-text {
  color: var(--dl-color-default-dark100);
  font-size: 18px;
  font-family: Inter, sans-serif;
  font-weight: 400;
  line-height: 24px;
}

.create-new-section {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

#share-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
}

#share-modal.hidden {
  display: none !important;
}

.share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.share-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 560px;
  max-width: calc(100% - 32px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 50px 0 rgb(195 177 162 / 25%);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#share-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

#share-form .email-input {
  width: 100%;
  flex: none;
}

#share-form button {
  width: 100%;
  flex: none;
}

#cf-turnstile-mount {
  width: 100%;
  display: flex;
  justify-content: center;
}

@media (width <= 767px) {
  .share-dialog {
    width: auto;
    max-width: calc(100% - 32px);
    padding: 16px;
  }
  #share-form {
    flex-direction: column;
    align-items: stretch;
  }
  #share-form .email-input,
  #share-form button,
  #cf-turnstile-mount {
    width: 100%;
  }
}



.community-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.community-title {
  color: var(--dl-color-default-dark100);
  font-size: 22px;
  font-family: Inter, sans-serif;
  font-weight: 700;
  line-height: 28px;
}

.community-description {
  color: var(--dl-color-default-dark90);
  font-size: 16px;
  font-family: Inter, sans-serif;
  font-weight: 400;
  line-height: 24px;
}


.email-input-container {
  flex-grow: 1;
  max-width: 300px;
}


.privacy-notice {
  text-align: center;
}

.privacy-text {
  color: var(--dl-color-default-dark90);
  font-size: 14px;
  font-family: Inter, sans-serif;
  font-weight: 400;
  line-height: 20px;
}

.footer-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
  padding: 16px 0;
}

.footer-text {
  color: var(--dl-color-default-dark90);
  font-size: 16px;
  font-family: Inter, sans-serif;
  font-weight: 400;
  line-height: 20px;
}

/* --- SUGGESTED STYLES (appended to override existing where needed) --- */
/* Apply the new Merriweather font across body text and inputs */
body, .text.body, .text.subtitle, .input {
  font-family: 'Merriweather', Georgia, 'Times New Roman', serif;
}

/* Style the main title to use Merriweather and brand color */
.text.title {
  font-family: 'Merriweather', Georgia, 'Times New Roman', serif;
  color: #6B4F4B;
  font-weight: 700;
}

/* Style the accent button with the new teal and Merriweather */
.button.accent {
  background-color: var(--dl-color-default-primary);
  font-family: 'Merriweather', Georgia, 'Times New Roman', serif;
  font-weight: 700;
}

/* Ensure other buttons use the new font */
.button.primary, .button.secondary {
  font-family: 'Merriweather', Georgia, 'Times New Roman', serif;
  font-weight: 700;
}

/* Footer link matches brand typography/color */
.footer-link {
  font-family: 'Merriweather', Georgia, 'Times New Roman', serif;
  color: #6B4F4B;
  font-weight: 700;
}

.memorypage-container {
  width: 100%;
  display: flex;
  overflow: auto;
  min-height: 100vh;
  align-items: center;
  flex-direction: column;
  background-color: var(--dl-color-default-beige);
}

.memorypage-content {
  width: 100%;
  height: auto;
  min-height: 1204px;
  display: flex;
  overflow: hidden;
  position: relative;
  align-items: flex-start;
  flex-shrink: 0;
  background-color: var(--dl-color-default-beige);
}

.memorypage-modal {
  gap: 24px;
  top: 60px;
  left: 0;
  right: 0;
  width: 580px;
  margin: auto;
  display: flex;
  padding: 16px;
  position: absolute;
  box-shadow: 0 8px 50px 0 rgb(195 177 162 / 25%);
  align-items: flex-start;
  flex-shrink: 0;
  border-radius: 12px;
  flex-direction: column;
  justify-content: center;
  background-color: rgb(255 255 255 / 100%);
}

/* Email Signup Flex Placement */
.modal.memory #first_name,
.modal.memory #last_name {
  flex: 1 0 calc(50% - 4px);
  min-width: 0;
  box-sizing: border-box;
  width: auto;
}
.modal.memory #email {
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
  width: auto;
}
.modal.memory #signup-submit {
  flex: 0 0 auto;
  width: 220px;
  height: 48px;
}

/* Center Turnstile in Signup (not full width) */
.modal.memory #signup-form .cf-turnstile {
  align-self: center;
  display: inline-block;  /* shrink to intrinsic width */
  width: auto;            /* ensure it doesn’t stretch */
}

/* Print-only layout for Memory Page */
@media print {
  /* Reserve vertical space for fixed header/footer overlays (brand/meta + URL) */
  :root {
    /* 0.5in top + 0.5in bottom margins plus overlay content => ~2in reserve */
    --print-available-height: calc(100vh - 2in);
  }

  /* Page margins (adjust if needed) */
  @page { size: 8.5in 11in; margin: 0.5in; }

  /* Neutralize backgrounds/chrome */
  html, body,
  .container,
  .main-content.memory,
  .modal.memory {
    background: #fff !important;
    box-shadow: none !important;
  }

  /* Hide everything by default */
  body * {
    visibility: hidden !important;
  }

  /* Re-enable visibility for ancestry of shown content */
  .container,
  .main-content.memory,
  .modal.memory {
    visibility: visible !important;
  }

  /* Show only the collage + caption and the print-only UI */
  .modal.memory .photo-section,
  .modal.memory .photo-section *,
  #print-brand, #print-brand *,
  #print-meta, #print-meta *,
  #print-url, #print-url * {
    visibility: visible !important;
  }

  /* Ensure only the photo-section renders from within the modal */
  .modal.memory > *:not(.photo-section) {
    display: none !important;
  }

  /* Ensure print-only containers render despite .hidden { display:none !important } */
  #print-brand, #print-meta, #print-url {
    display: block !important;
  }

  /* Prevent screen layout height from affecting print page height */
  html, body {
    height: auto !important;
  }

  /* Position brand (top-left), date/time (top-right), and URL (bottom-left) */
  #print-brand {
    position: fixed;
    top: 0.5in;
    left: 0.5in;
    display: flex !important;
    align-items: center;
    gap: 8px;
    z-index: 1000;
  }

  /* Match memory page footer-link styling for print brand */
  #print-brand .footer-link {
    font-style: italic;
    font-weight: 500;
    font-size: 18px;
    line-height: 28px;
    color: #7E4012;
  }

  #print-meta {
    position: fixed;
    top: 0.5in;
    right: 0.5in;
    font: inherit;
    color: var(--dl-color-default-dark90);
    text-align: right;
    z-index: 1000;
  }

  #print-url {
    position: fixed;
    bottom: 0.5in;
    left: 0.5in;
    font-size: 12px;
    color: var(--dl-color-default-dark90);
    z-index: 1000;
    word-break: break-all;
  }

  /* Center the collage+caption vertically and fit width within margins */
  .modal.memory .photo-section {
    position: fixed;
    /* Fill the printable box between header/footer overlays and margins */
    top: 1in;          /* 0.5in margin + ~0.5in overlay */
    bottom: 1in;       /* 0.5in margin + ~0.5in overlay */
    left: 0.5in;
    right: 0.5in;
    margin: 0;
    padding: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    z-index: 500;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Remove frame chrome; let content span printable width */
  .modal.memory .photo-frame {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    /* Make image take remaining space and caption size to content */
    display: grid;
    /* Allow the image row to shrink fully when caption grows */
    grid-template-rows: minmax(0, 1fr) auto;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
    overflow: hidden;
  }

  /* Scale image to width, preserve aspect, and constrain height for caption */
  .modal.memory .memory-photo {
    width: 100% !important;
    max-width: 100% !important;
    /* Fill the first grid row; scale down as needed to keep caption on page */
    height: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block;
  }

  /* Caption beneath image; avoid breaking across pages */
  .modal.memory .photo-frame .text.body {
    margin-top: 12px !important;
    white-space: pre-wrap;
    page-break-inside: avoid;
    break-inside: avoid;
    color: var(--dl-color-default-dark100);
    /* Smaller, print-optimized typography for long captions */
    font-size: 14px !important;
    line-height: 20px !important;
    /* Constrain to printable width and wrap long words/URLs */
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
  }
}
