:root {
  --bg-main: #f4eee4;
  --brown: #622617;
  --cream: #f7f1e8;
  --cherry-red: #8c2f33;
  --metal: #d2cdc4;
  --text-main: #66372B;
  --accent: #c5705a;
  --dot-grey: #b9aa9f;
  --dot-green: #68a35b;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Playfair Display", serif;
  color: var(--brown);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.4), transparent 45%),
    radial-gradient(circle at 75% 10%, rgba(255, 255, 255, 0.3), transparent 40%),
    linear-gradient(180deg, rgba(247, 241, 232, 0.94) 0%, rgba(237, 226, 212, 0.94) 50%, rgba(229, 217, 201, 0.94) 100%);
}

body {
  min-height: 100vh;
}

h1,
h2,
h3,
.cursive-heading {
  font-family: "adobe-handwriting-ernie", sans-serif;
  color: #775249;
}

/* Global top bar */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  backdrop-filter: blur(8px);
  z-index: 50;
}

.top-left {
  justify-self: start;
}

.top-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-right: 1.3rem;
}

.brand-button {
  border: none;
  background: none;
  font-family: "adobe-handwriting-ernie", sans-serif;
  font-size: 2rem;
  cursor: pointer;
  color: var(--brown);
  padding-top: 1rem;
}

/* Screens */

.screen {
  display: none;
  min-height: 100vh;
  padding: 4.5rem 1.5rem 0.5rem; 
  position: relative;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

#printing.screen {
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

#about.screen {
  display: none;
}

#about.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding-top: 5rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Utility */

.hidden {
  display: none !important;
}

.muted {
  color: #915759;
}

/* Buttons - shared typeface */
button,
.btn,
.icon-button,
.count-option,
.filter-btn {
  font-family: "Playfair Display", serif;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  border: none;
  background: var(--cherry-red);
  color: #fff;
  font-weight: 400;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
  font-size: 0.95rem;
}

.btn:hover {
  background: #782B2D;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.btn:disabled {
  background: #C99D9E;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  background: #ffffffd8;
  color: var(--text-main);
  border: 1px solid #ccb8a5;
}

.btn-secondary:hover {
  background: #fff;
}

/* Icon buttons */

.icon-button {
  position: static;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  font-size: 1rem;
  color: var(--brown);
  z-index: 5;
}

.icon-button span {
  display: inline-flex;
  align-items: center;
}

.icon-arrow-left {
  width: 0.95rem;
  height: 0.95rem;
  border-left: 3px solid var(--brown);
  border-bottom: 3px solid var(--brown);
  transform: rotate(45deg);
}

.back-button {
  display: none !important; 
}

.back-button span:last-child {
  display: none;
}

.top-right .icon-button {
  position: static;
  color: var(--brown);
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--brown);
  padding: 0;
  font-size: 1rem;
}

.about-link {
  background: none;
  border: none;
  color: var(--brown);
  padding: 0;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.about-link img.about-icon {
  width: 18px;
  height: 18px;
  display: none;
}

.header-back {
  justify-self: start;
  margin-left: 0.75rem;
  display: none;
}

.about-social {
  position: absolute;
  top: 2rem;
  right: 1.2rem;
  display: flex;
  gap: 0.8rem;
  z-index: 70;
}

.about-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.82;
  transition: opacity 0.15s ease;
}

.about-social-link:hover {
  opacity: 1;
}

.about-social-link img {
  display: block;
}

.icon-instagram img {
    margin-top: 3px;
}

.about-social-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--brown);
  font-size: 1.4rem;
  cursor: pointer;
}

.about-social-menu {
  display: flex;
  gap: 0.8rem;
}

@media (max-width: 640px) {
  .about-social {
    top: 1.5rem;
    right: 0.8rem;
    flex-direction: column;
    align-items: flex-end;
  }

  .about-social-menu {
    display: none;
    flex-direction: column;
    gap: 0.45rem;
    align-items: flex-end;
  }

  .about-social-menu.show {
    display: flex;
  }

  .about-social-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .about-social-link {
    padding: 0.1rem 0.25rem;
  }
}

.about-stack {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.about-photo {
  width: min(180px, 50vw);
  transform: rotate(7deg);
  position: relative;
  left: -25px;
  height: 650px;
}

.about-card {
  position: absolute;
  top: 45%;
  left: 70%;
  transform: translate(-50%, -50%);
  background: #fdf6ec;
  border: 4px solid #AF9690;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
  max-width: 320px;
  width: 72vw;
}

.about-card-inner {
  padding: 1.4rem 1.4rem 1rem;
  color: #622617;
  font-size: 0.95rem;
  line-height: 1.4;
}

.about-heart {
  width: 18px;
  height: 18px;
  margin-bottom: 0.6rem;
}

.about-heart img {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 640px) {
  #about.screen.active {
    padding-left: 1.4rem;
    padding-right: 1.4rem;
  }

  .about-stack {
    width: 100%;
  }

  .about-photo {
    left: -50px;
  }

  .about-card {
    left: 50%;
    width: 80vw;
  }
}

/* Landing */

.landing-inner {
  max-width: 1100px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.landing-top {
  display: flex;
  gap: 2.5rem;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  overflow-x: auto;
}

/* Booth illustration */

.booth-illustration {
  width: 320px;
  display: grid;
  place-items: center;
  margin-top: 0.8rem;
}

.booth-illustration img,
.booth-illustration-img {
  width: 100%;
  height: auto;
  display: block;
}

/* Sample strips */

.sample-strips {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sample-strips-img {
  width: 220px;
  max-width: 100%;
  height: auto;
  display: block;
}

/* Landing text */

.landing-bottom {
  text-align: center;
}

.landing-sub {
  margin: 0.5rem 0 1.1rem;
  font-size: 0.95rem;
}

.landing-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.landing-footer {
  margin-top: 1rem;
  text-align: center;
  color: #66372B;
  font-size: 0.8rem;
}

.landing-footer a {
  color: inherit;
  text-decoration: none;
  font-weight: 400;
}

/* Center card shared */

.center-card {
  max-width: 420px;
  width: 100%;
  background: #fbf6ee;
  padding: 2rem 1.75rem;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  text-align: center;
}

.center-card h2 {
  margin-top: 0.2rem;
  margin-bottom: 0.4rem;
}

.count-options {
  display: flex;
  gap: 0.75rem;
  margin: 1.25rem 0 1.5rem;
  justify-content: center;
}

.count-option {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 2px solid #AF9690;
  background: #fffaf4;
  color: #775249;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s ease, transform 0.1s ease, border-color 0.1s ease;
}

.count-option:hover {
  transform: translateY(-1px);
}

.count-option.selected {
  background: var(--cherry-red);
  color: #fff;
  border-color: var(--cherry-red);
}

/* Camera */

.camera-screen {
  background: #000;
}

.camera-full {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.camera-view {
  width: 320px;
  height: 420px;
  border-radius: 0;
  overflow: hidden;
  background: #000;
  border: 0;
  position: relative;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-text-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #ffffff;
}

.camera-message {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.camera-countdown {
  font-size: 2.8rem;
}

.shutter-flash {
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
}

.shutter-flash.flash {
  animation: flash 180ms ease-out;
}

@keyframes flash {
  0% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
  }
}

.dots-row {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--dot-grey);
}

.dot.active {
  background: var(--dot-green);
}

/* Upload */

.upload-layout {
  max-width: 900px;
  width: 100%;
  background: #fbf6ee;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  padding: 2rem 1.75rem 2.5rem;
  text-align: center;
}

.upload-header h2 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.upload-header p {
  margin: 0;
}

.upload-slots {
  margin: 1.2rem 0 1.75rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

#continueUpload {
  display: inline-flex;
  margin: 0 auto;
}

.upload-slot {
  width: 140px;
  height: 175px; 
  background: #f0e3d4;
  border-radius: 0;
  border: 2px dashed #AF9690;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-slot-label {
  text-align: center;
  font-size: 1.7rem;
  padding: 0.4rem;
  color: #775249;
}

.upload-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Replace overlay */

.slot-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
}

.upload-slot.has-image:hover .slot-overlay {
  opacity: 1;
}

/* Customize */

.customize-layout {
  max-width: 1000px;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "heading heading"
    "controls preview";
  gap: 1.5rem 2rem;
  align-items: flex-start;
  margin-top: 0.3rem;
}

.customize-heading {
  grid-area: heading;
  text-align: center;
}

.customize-title {
  margin: 0;
}

.customize-controls {
  grid-area: controls;
  background: #fbf6ee;
  border-radius: 18px;
  padding: 1.7rem 1.4rem 2rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  align-self: center;
}

.customize-preview {
  grid-area: preview;
  display: flex;
  align-items: center;
  justify-content: center;
}

.strip-preview {
  width: 190px;
  padding: 0.7rem;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  justify-content: center;
  position: relative;
  border-radius: 0;
}

.strip-photo {
  flex: none;
  aspect-ratio: 4 / 5;
  width: 100%;
  background: #222;
  border-radius: 0;
  overflow: hidden;
}

.strip-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.strip-date {
  font-size: 1rem;
  text-align: center;
  margin-top: 0.1rem;
  margin-bottom: -6px;
  color: #66372B;
  font-family: "adobe-handwriting-ernie", sans-serif;
}

/* Strip themes */

.strip-preview.theme-black {
  background: #171717;
}

.strip-preview.theme-black .strip-date {
  color: #f4eee4;
}

.strip-preview.theme-cream {
  background: var(--cream);
}

.strip-preview.theme-red {
  background: var(--cherry-red);
}

.strip-preview.theme-red .strip-date {
  color: #fef2e6;
}

/* Controls */

.control-group + .control-group {
  margin-top: 1.2rem;
}

.control-group h3 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  font-family: "Playfair Display", serif;
  font-weight: 400;
}

.swatch-row {
  display: flex;
  gap: 0.6rem;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid #a38d79;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.swatch-black {
  background: #111;
}

.swatch-cream {
  background: var(--cream);
}

.swatch-red {
  background: var(--cherry-red);
}

.swatch-dots {
  background-color: #f8efe2;
  background-image: radial-gradient(#000 1.5px, transparent 1.5px),
    radial-gradient(#000 1.5px, transparent 1.5px);
  background-position: 0 0, 4px 4px;
  background-size: 8px 8px;
}

.swatch.selected {
  border-color: #725442;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.radio-label input {
  accent-color: var(--cherry-red);
}

.toggle-row {
  margin-top: 0.8rem;
}

/* Toggle */

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.toggle-label input {
  display: none;
}

.toggle-slider {
  width: 40px;
  height: 20px;
  border-radius: 999px;
  background: #c9b8a8;
  position: relative;
  transition: background 0.15s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.15s ease;
}

.toggle-label input:checked + .toggle-slider {
  background: var(--cherry-red);
}

.toggle-label input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Printing */

.printing-layout {
  max-width: 450px;
  width: 100%;
  background: #000;

  border-radius: 18px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  margin: 0 auto;
}

.printing-title {
  margin-top: 0;
  margin-bottom: -4px;
}

.printing-window {
  width: 190px;
  height: 100%;
  background: #000;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

#printedStrip {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  transform: translateY(-120%);
}

.printing-actions {
  margin-top: 0.6rem;
  text-align: center;
  width: 100%;
}

.btn-collect {
  min-width: 200px;
  visibility: hidden;
}

.btn-collect.show {
  visibility: visible;
}

/* Animation */

.printing-window.printing #printedStrip {
  animation: printStrip 1.2s forwards;
  animation-fill-mode: forwards;
}

@keyframes printStrip {
  0% {
    transform: translateY(-120%);
  }
  100% {
    transform: translateY(0%);
  }
}

/* Crop modal */

.crop-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.crop-modal-content {
  background: #171717;
  padding: 1.6rem 1.6rem 1.9rem;
  border-radius: 14px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  position: relative;
  color: #f7f1e8;
}

.crop-close {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  border: none;
  background: none;
  color: #f7f1e8;
  font-size: 1.4rem;
  cursor: pointer;
}

.crop-frame {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 4 / 5;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #f7f1e8;
  position: relative;
  background: #000;
}

#cropImg {
  position: absolute;
  left: 0;
  top: 0;
  cursor: grab;
}

.crop-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
      to right,
      rgba(255, 255, 255, 0.3) 1px,
      transparent 1px
    ),
    linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.3) 1px,
      transparent 1px
    );
  background-size: calc(100% / 3) calc(100% / 3);
  pointer-events: none;
}

.crop-instruction {
  font-size: 0.9rem;
  margin: 0.9rem 0 0.9rem;
}

.crop-apply {
  margin-top: 0.4rem;
}

/* Responsive */

@media (max-width: 800px) {
  .camera-view {
    width: 260px;
    height: 360px;
  }

  .customize-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "heading"
      "controls"
      "preview";
  }

  .customize-controls {
    margin-top: 1.2rem;
  }

  .landing-top {
    flex-direction: column;
  }

  .screen {
    padding: 4.5rem 1rem 0.5rem;
  }

  .icon-button {
    top: 4.8rem;
    left: 0.9rem;
  }

  .about-link .about-text {
    display: none;
  }

  .about-link img.about-icon {
    display: inline-block;
  }
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  transform: translateY(20px);
  background: rgba(119, 82, 73, 0.72);
  color: #f7f1e8;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 120;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* polka frame */
.strip-preview.theme-dots {
  background-color: #f8efe2;
  background-image: radial-gradient(#000 1.5px, transparent 1.5px),
    radial-gradient(#000 1.5px, transparent 1.5px);
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
}

/* frame swatches */
.swatch {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid #a38d79;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.swatch.selected {
  border-color: #5b4033;
}

.swatch.selected::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #5b4033;
  font-weight: 600;
}

/* filter buttons */
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #c2ad9a;
  color: #775249;
  background: #fffaf4;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease,
    transform 0.1s ease;
}

.filter-btn:hover {
  transform: translateY(-1px);
}

.filter-btn.selected {
  background: var(--cherry-red);
  color: #fff;
  border-color: var(--cherry-red);
  position: relative;
}

.filter-btn.selected::after {
  content: "✓";
  margin-left: 0.4rem;
  font-size: 0.8rem;
}

.control-group.toggle-row {
  margin-top: 1rem;
  margin-bottom: 1.3rem;
}

.printing-slot {
  margin: 1.2rem auto 1.2rem;
  width: 230px;
  height: min(65vh, 520px);
  border-radius: 14px;
  background: #000;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.printing-window {
  width: 190px;
  height: 100%;
  background: #000;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

#printedStrip {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  transform: translateY(-120%);
}

 .printing-window.printing #printedStrip {
   animation: printStrip 1.7s forwards;
   animation-fill-mode: forwards;
 }

@keyframes printStrip {
  0% {
    transform: translateY(-120%);
  }
  100% {
    transform: translateY(0%);
  }
}
