:root {
  color-scheme: light;
  --ink: #2d2a24;
  --muted: #6e665a;
  --paper: rgba(255, 252, 245, 0.88);
  --paper-solid: #fffaf0;
  --line: rgba(68, 59, 44, 0.18);
  --olive: #63704d;
  --rose: #b86f5a;
  --shadow: 0 24px 80px rgba(37, 32, 24, 0.24);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 248, 232, 0.26), rgba(255, 248, 232, 0.34)),
    url("/assets/qannari-mosaic-wallpaper.png") center / cover fixed;
}

button,
input {
  font: inherit;
}

.page-shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: clamp(18px, 4vw, 46px);
  gap: clamp(16px, 3vw, 30px);
}

.frame-stage {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(18px, 3vw, 30px);
  min-height: min(680px, 68svh);
}

.brand-line {
  width: min(920px, 100%);
  display: flex;
  justify-content: center;
  color: var(--paper-solid);
  text-shadow: 0 2px 20px rgba(46, 37, 25, 0.45);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 7vw, 6.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.photo-frame {
  width: min(860px, 100%);
  aspect-ratio: 16 / 10;
  position: relative;
  overflow: hidden;
  padding: clamp(12px, 2vw, 22px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.photo-frame::before {
  content: "";
  position: absolute;
  inset: clamp(12px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: 6px;
  pointer-events: none;
}

.photo-stack,
.slideshow-image,
.empty-state {
  width: 100%;
  height: 100%;
  border-radius: 5px;
}

.photo-stack {
  position: absolute;
  inset: clamp(12px, 2vw, 22px);
  overflow: hidden;
}

.slideshow-image {
  position: absolute;
  inset: 0;
  display: block;
  object-fit: cover;
  background: #e8dfcf;
  opacity: 0;
  transition: opacity 1200ms ease;
}

.slideshow-image.is-active {
  opacity: 1;
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(rgba(255, 250, 240, 0.62), rgba(255, 250, 240, 0.62)),
    url("/assets/qannari-mosaic-wallpaper.png") center / cover;
  text-align: center;
}

.empty-state p {
  max-width: 24rem;
  margin: 0;
  padding: 14px 18px;
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.82);
  color: var(--muted);
  line-height: 1.45;
}

.caption-row {
  position: absolute;
  left: clamp(20px, 3vw, 34px);
  right: clamp(20px, 3vw, 34px);
  bottom: clamp(20px, 3vw, 34px);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--paper-solid);
  text-shadow: 0 2px 12px rgba(31, 27, 22, 0.58);
  font-size: 0.9rem;
}

.upload-panel {
  width: min(920px, 100%);
  justify-self: center;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.9);
  box-shadow: 0 12px 42px rgba(37, 32, 24, 0.17);
  backdrop-filter: blur(10px);
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(160px, 0.8fr) minmax(180px, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: clamp(14px, 2.4vw, 22px);
}

.upload-copy h1 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  line-height: 1.2;
}

.upload-copy p,
.upload-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 10px 11px;
}

.file-picker {
  position: relative;
}

.file-picker input[type="file"] {
  position: absolute;
  inset: 24px 0 0;
  opacity: 0;
  cursor: pointer;
}

.file-control {
  min-height: 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 5px 10px 5px 5px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 5px;
  background: #efe5d2;
  color: var(--ink);
  padding: 5px 9px;
  white-space: nowrap;
}

#file-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.88rem;
}

button {
  min-height: 42px;
  border: 1px solid rgba(45, 42, 36, 0.16);
  border-radius: 6px;
  background: var(--olive);
  color: #fffaf0;
  padding: 10px 15px;
  cursor: pointer;
}

button:hover {
  background: #55613f;
}

.upload-status {
  grid-column: 1 / -1;
  min-height: 1.25rem;
}

@media (max-width: 820px) {
  .page-shell {
    padding: 16px;
  }

  .frame-stage {
    min-height: 58svh;
  }

  .photo-frame {
    aspect-ratio: 4 / 5;
  }

  .caption-row {
    flex-direction: column;
  }

  .upload-form {
    grid-template-columns: 1fr;
  }
}
