:root {
  --paper: #f4f1ea;
  --ink: #2c2926;
  --tape-blue: rgba(173, 216, 230, 0.5);
  --tape-pink: rgba(255, 182, 193, 0.5);
  --tape-yellow: rgba(250, 250, 210, 0.6);
  --path: #8d8478;
  --title-color: #b04b4b;
  --font-body: 'Indie Flower', cursive;
  --font-title: 'Caveat', cursive;
  --font-accent: 'Gochi Hand', cursive;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  overflow-x: hidden;
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.01) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.01) 1px, transparent 1px);
  background-size: 30px 30px;
}

.timeline-path {
  position: absolute;
  inset-inline-start: 50%;
  inset-block-start: 50%;
  inline-size: 2px;
  block-size: 100%;
  border-left: 2px dashed var(--path);
  transform: translateX(-50%);
  z-index: 0;
  opacity: 0.13;
}

header {
  height: 35vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 10;
}

.journal-title {
  font-family: var(--font-title);
  font-size: clamp(3.5rem, 10vw, 6rem);
  line-height: 1;
  transform: rotate(-2deg);
}

.journal-subtitle {
  color: var(--ink);
  font-size: 1.2rem;
  margin-top: 15px;
  opacity: 0.6;
  border: none;
  background: transparent;
  text-align: center;
  width: 80%;
  font-family: inherit;
}

.intro-section {
  max-width: 650px;
  margin: 0 auto 100px;
  text-align: center;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

.intro-text {
  font-family: var(--font-accent);
  font-size: 1.4rem;
  line-height: 1.6;
  color: var(--ink);
  border: none;
  background: transparent;
  width: 100%;
  text-align: center;
  resize: none;
  overflow: hidden;
  cursor: text;
  padding: 10px;
  border-radius: 8px;
}

.intro-text:focus,
.journal-subtitle:focus {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.4);
}

.scrapbook-container {
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
  padding: 0 20px 100px;
}

.memory {
  position: relative;
  margin-bottom: 25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  view-timeline-name: --memory;
  view-timeline-axis: block;
}

.memory-text {
  max-width: 400px;
  margin-bottom: 3rem;
  text-align: center;
  animation: textReveal linear both;
  animation-timeline: --memory;
  animation-range: entry 10% cover 40%;
}

@keyframes textReveal {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.location-tag {
  font-family: var(--font-title);
  font-size: 2.2rem;
  color: var(--title-color);
  margin-bottom: 0.5rem;
  display: block;
  border: none;
  background: transparent;
  text-align: inherit;
  cursor: text;
  width: 100%;
}

.location-tag:focus,
.caption:focus {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 4px;
}

.caption {
  font-family: var(--font-accent);
  font-size: 1.3rem;
  line-height: 1.4;
  color: var(--ink);
  border: none;
  background: transparent;
  width: 100%;
  text-align: inherit;
  cursor: text;
  resize: none;
  overflow: hidden;
}

.memory-gallery {
  position: relative;
  width: 320px;
  height: 320px;
  perspective: 1000px;
}

.photo {
  position: absolute;
  top: 0;
  left: 0;
  background: #fff;
  padding: 10px 10px 40px 10px;
  box-shadow: 2px 5px 15px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.18s ease;
  animation: fanOut linear both;
  animation-timeline: --memory;
  animation-range: entry 20% cover 50%;
  transform-origin: center bottom;
  will-change: transform;
}

.photo img {
  width: 280px;
  height: 280px;
  object-fit: cover;
  display: block;
}

@keyframes fanOut {
  from {
    transform: rotate(0deg) translate(0, 0);
    opacity: 0;
  }

  to {
    transform: rotate(var(--rot)) translate(var(--x), var(--y));
    opacity: 1;
  }
}

.washi-tape {
  position: absolute;
  width: 80px;
  height: 25px;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(var(--tape-rot));
  z-index: 5;
  opacity: 0.7;
  clip-path: polygon(0% 10%, 4% 0%, 96% 0%, 100% 10%, 100% 90%, 96% 100%, 4% 100%, 0% 90%);
}

.photo:nth-child(1) {
  --rot: -12deg;
  --x: -60px;
  --y: 10px;
  z-index: 3;
}

.photo:nth-child(2) {
  --rot: 2deg;
  --x: 0px;
  --y: -10px;
  z-index: 2;
}

.photo:nth-child(3) {
  --rot: 15deg;
  --x: 60px;
  --y: 20px;
  z-index: 1;
}

@media (hover: hover) and (pointer: fine) {
  .photo:hover {
    z-index: 10 !important;
    transform: scale(1.04) rotate(0deg) !important;
  }
}

.memory:nth-child(even) {
  align-items: flex-end;
  padding-right: 15%;
}

.memory:nth-child(odd) {
  align-items: flex-start;
  padding-left: 15%;
}

/* empty state */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  margin: 0 auto 100px;
  max-width: 500px;
  animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-icon {
  font-size: 5rem;
  margin-bottom: 1.5rem;
  opacity: 0.7;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.empty-title {
  font-family: var(--font-title);
  font-size: 2.5rem;
  color: var(--title-color);
  margin-bottom: 1rem;
  text-transform: lowercase;
}

.empty-text {
  font-family: var(--font-accent);
  font-size: 1.3rem;
  line-height: 1.6;
  color: var(--ink);
  opacity: 0.7;
  margin-bottom: 2rem;
}

.empty-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--path);
  opacity: 0.6;
}

.empty-hint-arrow {
  font-size: 2rem;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(10px);
  }
}

@media (max-width: 768px) {
  .empty-state {
    padding: 60px 20px;
  }

  .empty-icon {
    font-size: 4rem;
  }

  .empty-title {
    font-size: 2rem;
  }

  .empty-text {
    font-size: 1.1rem;
  }
}

.add-memory {
  border: 3px dashed var(--path);
  padding: 40px;
  border-radius: 20px;
  width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0 auto 100px;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 20;
}
}

.add-memory-tip {
  position: absolute;
  inset-inline: 0;
  inset-block-start: -12px;
  display: flex;
  justify-content: center;
  pointer-events: auto;
}

.add-memory-tip-bubble {
  position: relative;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  color: var(--paper);
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transform: translateY(-100%);
  max-inline-size: 320px;
}

.add-memory-tip-bubble::after {
  content: '';
  position: absolute;
  inset-block-end: -8px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  border-width: 8px 8px 0 8px;
  border-style: solid;
  border-color: color-mix(in srgb, var(--ink) 92%, transparent) transparent transparent transparent;
}

.memory--text-only .memory-gallery {
  display: none;
}

.memory--text-only .memory-text {
  margin-bottom: 0;
  max-width: 520px;
}

/* text entry sheet */
.text-entry-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 1800;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.text-entry-sheet {
  inline-size: min(720px, 100%);
  background: var(--paper);
  border-top-left-radius: 1.25rem;
  border-top-right-radius: 1.25rem;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.25);
  padding: 1rem 1rem 1.25rem;
  margin: 0;
}

.text-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.text-entry-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--title-color);
  transform: rotate(-1deg);
}

.text-entry-close {
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

.text-entry-close:hover {
  opacity: 1;
}

.text-entry-close:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
  border-radius: 6px;
}

.text-entry-input {
  width: 100%;
  border: 2px dashed color-mix(in srgb, var(--path) 50%, transparent);
  background: rgba(255, 255, 255, 0.3);
  border-radius: 1rem;
  padding: 0.875rem 1rem;
  font-family: var(--font-accent);
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink);
  resize: none;
  overflow: hidden;
}

.text-entry-input:focus {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

.text-entry-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.text-entry-btn-primary,
.text-entry-btn-secondary {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1.05rem;
  text-transform: lowercase;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.text-entry-btn-primary {
  background: var(--title-color);
  color: var(--paper);
}

.text-entry-btn-secondary {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
}

.text-entry-btn-primary:hover,
.text-entry-btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.text-entry-btn-primary:focus-visible,
.text-entry-btn-secondary:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

.text-entry-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.add-memory:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.02);
}

.add-memory-loading {
  opacity: 0.7;
  cursor: wait !important;
  pointer-events: none;
}

.add-memory:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: color-mix(in srgb, var(--path) 10%, transparent) !important;
  border-color: color-mix(in srgb, var(--path) 30%, transparent);
  pointer-events: none;
}

.add-memory:disabled .add-icon,
.add-memory:disabled .add-text {
  opacity: 0.6;
}

.add-memory:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

.add-icon {
  font-size: 3rem;
  color: var(--path);
  margin-bottom: 10px;
}

.add-text {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: var(--path);
}

.theme-fab {
  position: fixed;
  inset-inline-end: 1.125rem;
  inset-block-end: 1.125rem;
  inline-size: 3.25rem;
  block-size: 3.25rem;
  border-radius: 1rem;
  border: 0.125rem solid hsl(0 0% 0% / 0.08);
  background: hsl(0 0% 100% / 0.7);
  backdrop-filter: blur(0.5rem);
  cursor: pointer;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.625rem 1.5625rem hsl(0 0% 0% / 0.12);
  transition: transform 0.12s ease, background 0.2s ease;
}

.theme-fab:hover {
  transform: translateY(-0.125rem);
  background: hsl(0 0% 100% / 0.9);
}

.theme-fab:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

.theme-panel {
  position: fixed;
  inset-inline-end: 1.125rem;
  inset-block-end: 5.125rem;
  inline-size: min(21.25rem, calc(100vw - 2.25rem));
  border-radius: 1.125rem;
  /* adaptive background based on paper color */
  background: color-mix(in srgb, var(--paper) 92%, var(--ink) 8%);
  backdrop-filter: blur(10px);
  border: 2px solid color-mix(in srgb, var(--ink) 20%, transparent);
  box-shadow: 0 1.125rem 2.5rem rgba(0, 0, 0, 0.25);
  padding: 0.875rem;
  z-index: 60;
  /* use ink color for text */
  color: var(--ink);
  /* always use system font for UI legibility */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.theme-panel::-webkit-scrollbar {
  width: 8px;
}

.theme-panel::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-radius: 10px;
}

.theme-panel::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 20%, transparent);
  border-radius: 10px;
}

.theme-panel h3 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--ink);
}

.journal-panel {
  margin-block-end: 0.75rem;
  padding-block-end: 0.75rem;
  border-block-end: 1px dashed color-mix(in srgb, var(--ink) 25%, transparent);
}

.journal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.journal-row label {
  font-size: 0.95rem;
  opacity: 0.75;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.journal-select {
  flex: 1;
  padding-block: 0.5rem;
  padding-inline: 0.625rem;
  border-radius: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.journal-actions {
  display: flex;
  gap: 0.625rem;
  margin-block-start: 0.625rem;
}

.journal-actions button {
  flex: 1;
  padding-block: 0.625rem;
  padding-inline: 0.75rem;
  border-radius: 0.875rem;
  border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  color: var(--ink);
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  transition: background 0.2s ease;
}

.journal-actions button:hover {
  background: color-mix(in srgb, var(--paper) 85%, transparent);
}

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 0.5rem;
}

.theme-row label {
  font-size: 0.95rem;
  opacity: 0.75;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.theme-row input[type='color'] {
  inline-size: 3.25rem;
  block-size: 2.125rem;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.theme-row input[type='color']:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
  border-radius: 4px;
}

.theme-row input[type='range'] {
  flex: 1;
}

.theme-row input[type='range']:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
  border-radius: 4px;
}

.theme-row select {
  inline-size: 11.25rem;
  padding-block: 0.5rem;
  padding-inline: 0.625rem;
  border-radius: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.theme-row select:focus-visible,
.journal-select:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

.theme-actions {
  display: flex;
  gap: 0.625rem;
  margin-block-start: 0.625rem;
}

.theme-actions button {
  flex: 1;
  padding-block: 0.625rem;
  padding-inline: 0.75rem;
  border-radius: 0.875rem;
  border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  color: var(--ink);
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  transition: background 0.2s ease;
}

.theme-actions button:hover {
  background: color-mix(in srgb, var(--paper) 85%, transparent);
}

.theme-actions button:focus-visible,
.journal-actions button:focus-visible,
.publish-actions button:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

.publish-panel {
  margin-block-start: 0.75rem;
  padding-block-start: 0.75rem;
  border-block-start: 1px dashed color-mix(in srgb, var(--ink) 25%, transparent);
}

.publish-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.publish-row label {
  font-size: 0.95rem;
  opacity: 0.75;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.publish-title {
  flex: 1;
  padding-block: 0.5rem;
  padding-inline: 0.625rem;
  border-radius: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.publish-title:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

.publish-actions {
  display: flex;
  gap: 0.625rem;
  margin-block-start: 0.625rem;
}

.publish-actions button {
  flex: 1;
  padding-block: 0.625rem;
  padding-inline: 0.75rem;
  border-radius: 0.875rem;
  border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  color: var(--ink);
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  transition: background 0.2s ease;
}

.publish-actions button:hover {
  background: color-mix(in srgb, var(--paper) 85%, transparent);
}

.publish-actions button:disabled,
.theme-actions button:disabled,
.journal-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: color-mix(in srgb, var(--ink) 10%, transparent) !important;
  color: color-mix(in srgb, var(--ink) 50%, transparent);
  border-color: color-mix(in srgb, var(--ink) 10%, transparent);
  pointer-events: none;
}

.publish-status {
  margin-block-start: 0.625rem;
  font-size: 0.95rem;
  opacity: 0.85;
  word-break: break-word;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-dialog {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-inline-size: min(900px, calc(100vw - 4rem));
  max-block-size: calc(100vh - 4rem);
  animation: slideUp 0.3s ease;
  block-size: 100%;
  inline-size: 100%;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* polaroid-style photo frame */
.lightbox-image {
  max-inline-size: 100%;
  max-block-size: 100%;
  object-fit: contain;
  background: #fff;
  padding: 20px 20px 60px 20px;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.1),
    0 10px 30px rgba(0, 0, 0, 0.2),
    0 20px 60px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  transform: rotate(-1deg);
  transition: transform 0.3s ease;
}

.lightbox-image::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  inline-size: 80px;
  block-size: 25px;
  background: var(--tape-yellow);
  opacity: 0.8;
  clip-path: polygon(0% 10%, 4% 0%, 96% 0%, 100% 10%, 100% 90%, 96% 100%, 4% 100%, 0% 90%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  inline-size: 3rem;
  block-size: 3rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
  border-color: #fff;
}

.lightbox-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inline-size: 3.5rem;
  block-size: 3.5rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 2rem;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.lightbox-prev {
  left: 1.5rem;
}

.lightbox-next {
  right: 1.5rem;
}

.lightbox-nav:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-50%) scale(1.1);
  border-color: #fff;
}

.lightbox-nav:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.lightbox-counter {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  color: #fff;
  font-family: var(--font-accent);
  font-size: 1rem;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* mobile responsive styles */
@media (max-width: 768px) {
  .lightbox {
    padding: 1rem;
  }

  .lightbox-dialog {
    max-inline-size: 100%;
    max-block-size: 100%;
  }

  .lightbox-image {
    padding: 15px 15px 45px 15px;
    max-inline-size: calc(100vw - 2rem);
    max-block-size: calc(100vh - 10rem);
  }

  .lightbox-close {
    top: 1rem;
    right: 1rem;
    inline-size: 2.5rem;
    block-size: 2.5rem;
    font-size: 1.2rem;
  }

  .lightbox-nav {
    inline-size: 3rem;
    block-size: 3rem;
    font-size: 1.5rem;
    bottom: 6rem;
    top: auto;
    transform: none;
  }

  .lightbox-prev {
    left: 1rem;
  }

  .lightbox-next {
    right: 1rem;
  }

  .lightbox-nav:hover {
    transform: scale(1.1);
  }

  .lightbox-counter {
    bottom: 1.5rem;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
  }
}

@media (max-width: 48rem) {
  .theme-fab {
    inset-inline-end: 0.75rem;
    inset-block-end: 0.75rem;
  }

  .theme-panel {
    /* full page on mobile */
    inset: 0;
    inline-size: 100%;
    border-radius: 0;
    border: none;
    max-height: 100vh;
    padding: 1.5rem;
    overflow-y: auto;
  }

  .theme-panel h3 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
  }

  .theme-row,
  .journal-row {
    padding-block: 0.75rem;
  }

  .theme-row label,
  .journal-row label,
  .publish-row label {
    font-size: 1rem;
  }
}

.delete-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--path);
  color: white;
  border: none;
  border-radius: 50%;
  inline-size: 24px;
  block-size: 24px;
  cursor: pointer;
  font-family: sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  opacity: 0;
  transition: opacity 0.2s;
}

.memory:hover .delete-btn {
  opacity: 1;
}

.delete-btn:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
  opacity: 1;
}

/* postmark stamp */
.postmark {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  transform: rotate(8deg);
  opacity: 0.6;
  font-family: 'Courier New', monospace;
}

.postmark-circle {
  position: relative;
  inline-size: 85px;
  block-size: 85px;
  border: 3px solid #b85450;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.postmark-text-top {
  font-size: 0.5rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  color: #b85450;
  text-align: center;
  line-height: 1;
  margin-bottom: 2px;
}

.postmark-date {
  font-size: 0.75rem;
  font-weight: bold;
  color: #b85450;
  letter-spacing: 0.05em;
  text-align: center;
  line-height: 1;
  margin: 3px 0;
}

.postmark-text-bottom {
  font-size: 0.45rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  color: #b85450;
  text-align: center;
  line-height: 1;
  margin-top: 2px;
}

.postmark-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: -10px;
}

.postmark-line {
  inline-size: 50px;
  block-size: 3px;
  background: #b85450;
  border-radius: 2px;
}

.postmark-line:nth-child(1) { inline-size: 45px; }
.postmark-line:nth-child(2) { inline-size: 50px; }
.postmark-line:nth-child(3) { inline-size: 48px; }
.postmark-line:nth-child(4) { inline-size: 52px; }
.postmark-line:nth-child(5) { inline-size: 46px; }

/* welcome modal */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.welcome-modal {
  background: var(--paper);
  border-radius: 1.5rem;
  max-width: 680px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  margin: auto;
  animation: welcomeSlideUp 0.4s ease;
}

@keyframes welcomeSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.welcome-content {
  padding: 2.5rem;
}

.welcome-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 2px dashed color-mix(in srgb, var(--ink) 15%, transparent);
}

.welcome-title {
  font-family: var(--font-title);
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.welcome-tagline {
  font-family: var(--font-accent);
  font-size: 1.2rem;
  color: var(--ink);
  opacity: 0.6;
}

.welcome-body {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-bottom: 2rem;
}

.welcome-body::-webkit-scrollbar {
  width: 8px;
}

.welcome-body::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-radius: 10px;
}

.welcome-body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 20%, transparent);
  border-radius: 10px;
}

.welcome-section {
  margin-bottom: 2.5rem;
}

.welcome-section:last-child {
  margin-bottom: 0;
}

.welcome-section h2 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--title-color);
  margin-bottom: 1rem;
  text-transform: lowercase;
}

.welcome-section p {
  font-family: var(--font-accent);
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.welcome-section p:last-child {
  margin-bottom: 0;
}

.welcome-steps {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.welcome-step {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.welcome-step-number {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--title-color);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: bold;
}

.welcome-step-content h3 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
  text-transform: lowercase;
}

.welcome-step-content p {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  opacity: 0.8;
}

.welcome-footer {
  display: flex;
  gap: 1rem;
  flex-direction: column;
}

.welcome-btn-primary,
.welcome-btn-secondary {
  padding: 0.875rem 1.5rem;
  border-radius: 3rem;
  font-family: var(--font-body);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-transform: lowercase;
}

.welcome-btn-primary {
  background: var(--title-color);
  color: var(--paper);
}

.welcome-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.welcome-btn-primary:focus-visible {
  outline: 2px solid var(--title-color);
  outline-offset: 2px;
}

.welcome-btn-secondary {
  background: transparent;
  color: var(--ink);
  opacity: 0.6;
}

.welcome-btn-secondary:hover {
  opacity: 1;
}

.welcome-btn-secondary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.welcome-btn-primary:disabled,
.welcome-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: color-mix(in srgb, var(--ink) 10%, transparent) !important;
  color: color-mix(in srgb, var(--ink) 50%, transparent);
  pointer-events: none;
}

@media (max-width: 768px) {
  .welcome-content {
    padding: 2rem 1.5rem;
  }

  .welcome-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
  }

  .welcome-title {
    font-size: 2.25rem;
  }

  .welcome-tagline {
    font-size: 1.1rem;
  }

  .welcome-section h2 {
    font-size: 1.5rem;
  }

  .welcome-section p {
    font-size: 1.05rem;
  }

  .welcome-body {
    max-height: 60vh;
  }
}

/* loading states */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  text-align: center;
}

.loading-text {
  font-family: var(--font-accent);
  font-size: 1.2rem;
  color: var(--ink);
  opacity: 0.7;
  margin-top: 1.5rem;
}

/* spinners */
.spinner,
.spinner-small,
.spinner-large {
  border: 3px solid color-mix(in srgb, var(--ink) 20%, transparent);
  border-top-color: var(--title-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
}

.spinner-small {
  width: 16px;
  height: 16px;
  border-width: 2px;
  margin-right: 0.5rem;
  display: inline-block;
  vertical-align: middle;
}

.spinner-large {
  width: 60px;
  height: 60px;
  border-width: 4px;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-with-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* undo toast */
.undo-toast {
  position: fixed;
  inset-block-end: 2rem;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  background: color-mix(in srgb, var(--ink) 95%, transparent);
  color: var(--paper);
  border-radius: 3rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 100;
  font-family: var(--font-body);
  font-size: 1rem;
  backdrop-filter: blur(10px);
}

.undo-message {
  color: var(--paper);
  opacity: 0.9;
}

.undo-btn {
  padding: 0.5rem 1rem;
  background: var(--paper);
  color: var(--ink);
  border: none;
  border-radius: 1.5rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: lowercase;
}

.undo-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.undo-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.undo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: color-mix(in srgb, var(--paper) 50%, transparent) !important;
  color: color-mix(in srgb, var(--ink) 50%, transparent);
  pointer-events: none;
}

@media (max-width: 768px) {
  .undo-toast {
    inset-inline-start: 1rem;
    inset-inline-end: 1rem;
    transform: none;
    inset-block-end: 1.5rem;
  }
}

@media (max-width: 768px) {
  /* .timeline-path {
    left: 20px;
  } */

  .memory {
    align-items: flex-start !important;
    padding-left: 50px !important;
    padding-right: 0 !important;
  }

  .memory-text {
    text-align: left;
  }

  .memory-gallery {
    inline-size: 240px;
    block-size: 240px;
  }

  .photo img {
    inline-size: 200px;
    block-size: 200px;
  }

  .photo:nth-child(1) {
    --x: -20px;
  }

  .photo:nth-child(3) {
    --x: 30px;
  }
}
