/* 
 * VINTAGE THEME PROTOTYPE 
 * Warm, Old, Paper-like aesthetic. No dark modes.
 */

:root {
  /* Palette - Warm Paper & Ink */
  --v-paper-bg: #F6F1E7;    /* Base paper color */
  --v-sidebar-bg: #E8E0D2;  /* Slightly darker parchment for UI areas */
  --v-panel-bg: #F0EAD6;    /* Cream for right panel */
  
  --v-ink-primary: #3E2723; /* Dark brown ink for text */
  --v-ink-secondary: #5D4037; /* Lighter brown for secondary text */
  --v-ink-muted: #8D6E63;   /* Muted brown for icons/placeholders */
  
  --v-accent: #8B4513;      /* Saddle Brown accent */
  --v-highlight: #D7CCC8;   /* Selection/Hover color */
  
  --v-border: #C1B098;      /* Soft taupe borders */
  
  /* Typography */
  --v-font-serif: var(--font-serif);
  --v-font-display: 'Cormorant Garamond', serif;
}

body.vintage-theme {
  margin: 0 !important;
  padding: 0 !important;
  font-family: var(--v-font-serif);
  color: var(--v-ink-primary);
  background-color: var(--v-sidebar-bg);
  height: 100vh;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.vintage-layout {
  display: grid;
  grid-template-columns: 80px 1fr 300px;
  height: 100vh;
  width: 100vw;
}

/* 1. SIDEBAR (The Spine) */
.vintage-sidebar {
  background-color: var(--v-sidebar-bg);
  border-right: 1px solid var(--v-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  /* subtle texture */
  background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%238b4513' fill-opacity='0.03' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");
}

.vintage-logo {
  color: var(--v-accent);
  margin-bottom: 40px;
}

.vintage-nav__item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--v-ink-muted);
  border-radius: 8px;
  cursor: var(--cursor-pointer);
  transition: all 0.2s ease;
}

.vintage-nav__item:hover {
  background-color: rgba(139, 69, 19, 0.05);
  color: var(--v-accent);
}

.vintage-nav__item.active {
  color: var(--v-accent);
  background-color: var(--v-paper-bg);
  box-shadow: 0 2px 4px rgba(62, 39, 35, 0.05);
  border: 1px solid var(--v-border);
}

.vintage-sidebar__footer {
  margin-top: auto;
}

.vintage-avatar {
  width: 36px;
  height: 36px;
  background-color: var(--v-accent);
  color: var(--v-paper-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

/* 2. MAIN CANVAS */
.vintage-main {
  background-color: #E6DCCF; /* Desk background */
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  position: relative;
  /* Canvas texture */
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.vintage-utility-bar {
  width: 100%;
  max-width: 800px;
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.vintage-date {
  font-family: var(--v-font-display);
  font-style: italic;
  font-size: 18px;
  color: var(--v-ink-secondary);
}

.vintage-btn-icon {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  color: var(--v-ink-primary);
  opacity: 0.6;
}
.vintage-btn-icon:hover { opacity: 1; }

.vintage-actions {
  display: flex;
  gap: 12px;
}

.vintage-btn {
  font-family: var(--v-font-serif);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: var(--cursor-pointer);
  transition: all 0.2s;
}

.vintage-btn--ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--v-ink-secondary);
}
.vintage-btn--ghost:hover {
  background: rgba(62, 39, 35, 0.05);
  color: var(--v-ink-primary);
}

.vintage-btn--primary {
  background: var(--v-accent);
  color: white;
  border: 1px solid var(--v-accent);
  box-shadow: 0 2px 4px rgba(139, 69, 19, 0.2);
}
.vintage-btn--primary:hover {
  background: #6D360F; /* Darker accent */
  transform: translateY(-1px);
}

.vintage-btn--secondary {
  background: transparent;
  color: var(--v-accent);
  border: 1px solid var(--v-accent);
}
.vintage-btn--secondary:hover {
  background: rgba(139, 69, 19, 0.05);
  box-shadow: 0 2px 4px rgba(139, 69, 19, 0.1);
  transform: translateY(-1px);
}

/* Premium encrypted button — gold foil style */
.vintage-btn--encrypted {
  background: linear-gradient(135deg, #92400e 0%, #b45309 40%, #d97706 70%, #92400e 100%);
  background-size: 200% 200%;
  color: #fff8e1;
  border: 1px solid #b45309;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  font-weight: 700;
  letter-spacing: 0.02em;
  animation: shimmer-gold 3s ease infinite;
  position: relative;
  overflow: hidden;
}
.vintage-btn--encrypted::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
  background-size: 200% 100%;
  animation: shine-sweep 2.5s ease infinite;
}
.vintage-btn--encrypted:hover {
  background: linear-gradient(135deg, #78350f 0%, #92400e 40%, #b45309 70%, #78350f 100%);
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.5), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
  color: #fffbeb;
}
.encrypted-btn-icon {
  font-style: normal;
}
@keyframes shimmer-gold {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes shine-sweep {
  0%   { background-position: -100% 0; }
  60%  { background-position: 200% 0; }
  100% { background-position: 200% 0; }
}

/* The Paper Sheet */
.vintage-paper {
  width: 100%;
  max-width: 740px;
  min-height: 900px;
  height: auto; /* explicit */
  flex-shrink: 0; /* prevent shrinking */
  overflow: visible; /* let content flow, but container should grow */
  background-color: var(--v-paper-bg);
  box-shadow: 0 4px 20px rgba(62, 39, 35, 0.08); /* Warm shadow */
  margin-bottom: 60px;
  padding: 60px 80px;
  position: relative;
  border: 1px solid rgba(0,0,0,0.02);
}

/* Paper Lines overlay (optional feeling) */
.vintage-paper::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 100% 32px; /* Line height */
  margin-top: 100px; /* Start below title */
}

.vintage-title-input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--v-font-display);
  font-size: 42px;
  color: var(--v-ink-primary);
  margin-bottom: 40px;
  position: relative;
  z-index: 2;
  -webkit-appearance: none;
  border-radius: 0;
}
.vintage-title-input:focus {
  outline: none;
}
.vintage-title-input::placeholder {
  color: var(--v-ink-muted);
  font-style: italic;
}

.vintage-content {
  font-size: var(--text-editor);
  line-height: var(--line-editor); /* generous leading */
  color: var(--v-ink-primary);
  position: relative;
  z-index: 2;
  max-height: 999999px; /* Disable Android Chrome font boosting */
}

.vintage-content img,
.vintage-content video {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
  display: block;
  margin: 1em 0;
}

.vintage-content .ProseMirror {
  outline: none;
  min-height: 600px;
  width: 100%;
  font-family: var(--v-font-serif);
  max-height: 999999px; /* Disable Android Chrome font boosting */
}
.vintage-content .ProseMirror p {
  margin-bottom: 0.6em;
  margin-top: 0;
  font-family: var(--v-font-serif);
  max-height: 999999px; /* Disable Android Chrome font boosting */
}

.vintage-content h3 {
  font-family: var(--v-font-display);
  font-size: 24px;
  margin-top: 32px;
  margin-bottom: 16px;
  color: var(--v-accent);
}

/* TIPTAP TOOLBAR */
.vintage-content .tiptap-toolbar {
  background: transparent;
}

.vintage-content .tiptap-toolbar__button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--v-ink-secondary);
  border-radius: 50%;
  cursor: var(--cursor-pointer);
  font-family: var(--v-font-sans);
  font-size: 14px;
  font-weight: 600;
}

.vintage-content .tiptap-toolbar__button:hover {
  background-color: color-mix(in srgb, var(--v-accent) 8%, transparent);
  color: var(--v-ink-primary);
}

.vintage-content .tiptap-toolbar__button.is-active,
.vintage-content .tiptap-toolbar__button--active,
.vintage-content .tiptap-toolbar__button[aria-pressed="true"] {
  color: var(--v-paper-bg);
  background-color: var(--v-accent);
}

.vintage-content .tiptap-toolbar__separator {
  display: block;
  width: 20px;
  height: 1px;
  background-color: var(--v-border);
  margin: 4px 0;
}

.vintage-content .tiptap-toolbar__toggle {
  border-color: var(--v-border);
  background: color-mix(in srgb, var(--v-paper-bg) 92%, var(--v-panel-bg));
  color: var(--v-accent);
}

.vintage-content .tiptap-toolbar__toggle:hover,
.vintage-content .tiptap-toolbar.is-open .tiptap-toolbar__toggle {
  border-color: var(--v-accent);
  background: var(--v-paper-bg);
  color: var(--v-ink-primary);
}

.vintage-content .tiptap-toolbar__content {
  background: color-mix(in srgb, var(--v-paper-bg) 96%, var(--v-panel-bg));
  border-color: transparent;
}

.vintage-content .tiptap-toolbar.is-open .tiptap-toolbar__content {
  border-color: var(--v-border);
}

@media (max-width: 1024px) {
  .vintage-content .tiptap-toolbar__button {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .vintage-content .tiptap-toolbar__separator {
    width: 1px;
    height: 20px;
    margin: 0 4px;
  }
}
.vintage-panel {
  background-color: var(--v-panel-bg);
  border-left: 1px solid var(--v-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Parent clips children */
  height: 100vh;
}

.vintage-panel__header {
  border-bottom: 2px double var(--v-border);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.vintage-panel__header h3 {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--v-ink-secondary);
  font-family: var(--v-font-sans); /* Fallback */
}

.vintage-assets {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vintage-card, .vintage-ticket {
  background: var(--v-paper-bg);
  border: 1px solid var(--v-border);
  padding: 8px;
  box-shadow: 0 1px 3px rgba(62, 39, 35, 0.05);
  transition: transform 0.2s;
  cursor: var(--cursor-pointer);
}

.vintage-card:hover, .vintage-ticket:hover {
  transform: translateY(-2px) rotate(1deg);
  box-shadow: 0 4px 8px rgba(62, 39, 35, 0.1);
}

.vintage-card__image {
  height: 100px;
  background-color: #D7CCC8;
  margin-bottom: 8px;
  border-radius: 2px;
  /* Ensure img tags behave like the prototype divs */
  width: 100%;
  object-fit: cover;
  display: block; 
}

/* Remove button for cards - positioned absolutely */
.vintage-card__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  padding: 4px; /* Slightly larger hit area */
  opacity: 0; /* Hidden by default to keep clean look */
  transition: all 0.2s ease;
  color: var(--v-ink-muted);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vintage-card:hover .vintage-card__remove {
  opacity: 1;
  background: rgba(255, 255, 255, 0.95);
  color: #D32F2F; /* Red highlight for destructive action */
  transform: scale(1.1);
  cursor: var(--cursor-pointer);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.vintage-card__meta {
  font-size: 12px;
  color: var(--v-ink-secondary);
  text-align: center;
  /* Truncate long names */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 4px;
}

.vintage-ticket {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-left: 3px solid var(--v-accent);
  overflow: hidden; /* For safety */
}

.vintage-ticket__stub {
  color: var(--v-accent);
  flex-shrink: 0;
}

.vintage-ticket__info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0; /* Critical for text-overflow in flex children */
}

.vintage-ticket__title {
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vintage-ticket__url {
  font-size: 11px;
  color: var(--v-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vintage-ticket__remove {
  opacity: 0;
  transition: all 0.2s ease;
  color: var(--v-ink-muted);
}

.vintage-ticket:hover .vintage-ticket__remove {
  opacity: 1;
  color: #D32F2F;
  transform: scale(1.1);
  cursor: var(--cursor-pointer);
}

.vintage-drop-zone {
  margin-top: auto;
  border: 2px dashed var(--v-border);
  border-radius: 8px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--v-ink-muted);
  font-style: italic;
  cursor: var(--cursor-pointer);
}
.vintage-drop-zone:hover {
  background-color: rgba(139, 69, 19, 0.05);
  border-color: var(--v-accent);
  color: var(--v-accent);
}
/* STICKERS & STAMPS SECTION */
.vintage-panel-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; 
  margin-bottom: 24px;
  overflow-y: auto; /* Allow this section to scroll independently */
  padding-right: 4px; /* Space for scrollbar */
}

/* RESPONSIVE BREAKPOINTS */

/* iPad / Tablet (Max 1024px) */
@media (max-width: 1024px) {
  .vintage-layout {
    grid-template-columns: 80px 1fr; /* 2 Columns: Nav | Canvas */
    grid-template-rows: 1fr auto;
    overflow-y: auto; /* Allow full page scroll */
    height: 100dvh;
    -webkit-overflow-scrolling: touch;
  }

  .vintage-sidebar {
    grid-row: 1 / -1;
    position: sticky;
    top: 0;
    height: 100vh;
  }

  .vintage-main {
    overflow: visible;
    min-height: auto;
  }
  
  /* Paper needs to flex on tablet */
  .vintage-paper {
    min-height: 60vh; 
    margin-bottom: 32px;
  }

  /* Right Panel Stacks Below Main Content */
  .vintage-panel {
    border-left: none;
    border-top: 2px solid var(--v-border);
    padding: 48px; /* Increased padding for better separation */
    height: auto;
    background: var(--v-sidebar-bg); /* Match sidebar bg for "outer shell" feel */
    flex-direction: row;
    flex-wrap: wrap;
    gap: 32px;
  }

  .vintage-panel-section {
    min-width: 300px;
    margin-bottom: 0;
    flex: 1 1 auto; /* Allow growing and shrinking correctly */
    overflow-y: visible; /* Prevent internal scroll, let page scroll */
    min-height: auto;
  }
}

/* Phone / Mobile (Max 768px) */
@media (max-width: 768px) {
  .vintage-layout {
    display: block;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .vintage-sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: 60px;
    flex-direction: row;
    padding: 0 16px;
    border-right: none;
    border-bottom: 1px solid var(--v-border);
    justify-content: space-between;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(62, 39, 35, 0.05); /* Added shadow for depth */
  }

  .vintage-logo {
    margin-bottom: 0;
  }

  .vintage-nav {
    display: flex;
    gap: 8px;
  }

  .vintage-nav__item {
    margin-bottom: 0;
    width: 36px;
    height: 36px;
  }

  .vintage-sidebar__footer {
    display: none; /* Hide avatar on mobile to save space */
  }

  .vintage-main {
    padding: 0;
  }

  .vintage-utility-bar {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    grid-template-areas: 
      "back date ."
      "actions actions actions";
    padding: 16px;
    gap: 16px;
    align-items: center;
    background: var(--v-sidebar-bg);
    border-bottom: 1px solid var(--v-border);
    margin-bottom: 0;
  }
  
  .vintage-date {
    grid-area: date;
    text-align: center;
    font-size: 15px;
    color: var(--v-text-muted);
    border: none;
    padding: 0;
    margin: 0;
  }

  .vintage-btn-icon {
    position: static;
    grid-area: back;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .vintage-actions {
    grid-area: actions;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding-bottom: 4px;
  }
  
  .vintage-actions::-webkit-scrollbar {
    display: none;
  }
  
  .vintage-actions .vintage-btn {
    flex: 1 0 auto;
    min-width: max-content;
    padding: 10px 16px;
  }

  .vintage-paper {
    padding: 24px 20px;
    margin-bottom: 0;
    box-shadow: none;
    border: none;
    min-height: auto;
    background: var(--v-bg);
  }

  .vintage-title-input {
    font-size: 32px;
    margin-bottom: 16px;
    line-height: 1.2;
  }
  
  .vintage-content {
    font-size: 17px;
  }

  .vintage-panel {
    flex-direction: column;
    padding: 24px;
    gap: 24px;
    border-top: 1px solid var(--v-border); /* Distinct separation */
  }

  .vintage-panel-section {
    min-width: 100%;
  }
}

/* Shared Component Overrides */
.input-modern {
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--v-border);
  font-family: var(--v-font-serif);
  color: var(--v-ink-primary);
  width: 100%;
  padding: 8px 0;
  margin-bottom: 8px;
}
.input-modern:focus {
  outline: none;
  border-bottom-style: solid;
  border-color: var(--v-accent);
}

.external-link-form__fields {
  background: var(--v-paper-bg);
  padding: 12px;
  border: 1px solid var(--v-border);
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(62, 39, 35, 0.05);
}

/* Reset memory-form styles interfering with vintage layout */
.vintage-theme .memory-form {
  margin: 0 !important;
  padding: 0 !important;
  display: contents; /* Allows grid to work as if form wasn't there, or use block with 100% */
}
/* Fallback if display: contents not desired */
.vintage-theme .memory-form {
  display: block;
  width: 100%;
  height: 100vh;
}





/* Hashtag Input Styling */
.vintage-tags-wrapper {
  background-color: var(--v-paper-bg);
  border: 1px solid var(--v-border);
  border-radius: 4px;
  padding: 6px;
  font-family: var(--v-font-serif);
  width: 100%;
  font-size: 14px;
  box-shadow: inset 0 1px 3px rgba(62, 39, 35, 0.05);
  transition: all 0.2s ease;
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  cursor: var(--cursor-text);
}

.vintage-tags-wrapper:focus-within {
  border-color: var(--v-accent);
  background-color: #FFF;
  box-shadow: inset 0 1px 3px rgba(62, 39, 35, 0.1), 0 0 0 2px rgba(139, 69, 19, 0.1);
}

.vintage-tags-input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--v-ink-primary);
  min-width: 60px;
  flex: 1;
  padding: 4px 0;
  margin: 0;
}

.vintage-tags-input::placeholder {
  color: var(--v-ink-muted);
  font-style: italic;
  opacity: 0.7;
}

.vintage-tag-pill {
  background-color: rgba(139, 69, 19, 0.08); /* Light accent bg */
  border: 1px solid rgba(139, 69, 19, 0.2);
  border-radius: 12px;
  padding: 2px 8px 2px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--v-accent);
  transition: all 0.2s;
}

.vintage-tag-pill:hover {
  background-color: rgba(139, 69, 19, 0.15);
  border-color: var(--v-accent);
}

.vintage-tag-pill__text {
  /* user-select: none; */
}

.vintage-tag-pill__remove {
  background: none;
  border: none;
  color: var(--v-accent);
  cursor: var(--cursor-pointer);
  font-size: 16px;
  line-height: 1;
  padding: 0;
  opacity: 0.6;
  display: flex; /* Center the X */
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 16px; 
  height: 16px;
}

.vintage-tag-pill__remove:hover {
  opacity: 1;
  background-color: rgba(139, 69, 19, 0.1);
}

/* Tags Display on Memory Page */
/* Tags Display on Memory Page */
.page-tags {
  margin-bottom: 24px;
  /* border-top: 1px dashed var(--v-border); Removed */
  /* padding-top: 16px; Removed */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-tag {
  font-family: var(--v-font-serif);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 14px;
  font-style: italic;
  transition: all 0.2s;
  /* Default backup */
  color: var(--v-accent);
  background-color: rgba(139, 69, 19, 0.05);
}

.page-tag:hover {
  transform: translateY(-1px);
  text-decoration: underline;
  cursor: var(--cursor-pointer);
  filter: brightness(0.95);
}

/* Colorful Vintage Inks using nth-of-type cycle */
.page-tag:nth-of-type(6n+1) { background-color: rgba(139, 69, 19, 0.1); color: #8B4513; } /* Saddle Brown */
.page-tag:nth-of-type(6n+2) { background-color: rgba(85, 107, 47, 0.1); color: #556B2F; } /* Olive Green */
.page-tag:nth-of-type(6n+3) { background-color: rgba(128, 0, 0, 0.1); color: #800000; } /* Maroon */
.page-tag:nth-of-type(6n+4) { background-color: rgba(72, 61, 139, 0.1); color: #483D8B; } /* Dark Slate Blue */
.page-tag:nth-of-type(6n+5) { background-color: rgba(210, 105, 30, 0.1); color: #D2691E; } /* Chocolate */
.page-tag:nth-of-type(6n+6) { background-color: rgba(47, 79, 79, 0.1); color: #2F4F4F; } /* Dark Slate Gray */

/* External Links Badge Display */
.page-link-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-family: var(--v-font-serif);
  background-color: var(--v-paper-bg);
  border: 1px solid rgba(139, 69, 19, 0.2);
  color: var(--v-accent);
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(62, 39, 35, 0.05);
}

.page-link-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(62, 39, 35, 0.1);
  border-color: var(--v-accent);
  background-color: rgba(139, 69, 19, 0.05);
  cursor: var(--cursor-pointer);
}

.page-link-badge a {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
}

.page-link-badge a:hover {
  text-decoration: underline;
}

.page-link-badge svg {
  color: inherit;
  opacity: 0.8;
}

.vintage-layout--no-sidebar {
  grid-template-columns: 1fr 300px;
}

@media (max-width: 1024px) {
  .vintage-layout--no-sidebar {
    grid-template-columns: 1fr;
  }
}

/* Memory editor — focused, mobile-first writing workspace */
.memory-editor {
  grid-template-columns: minmax(0, 1fr) 320px;
  background: #e9e2d6;
}

.memory-editor .vintage-main {
  padding: 0 28px 64px;
}

.memory-editor__header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  width: 100%;
  max-width: 860px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: 0;
  padding: 18px 0;
  background: #e9e2d6;
}

.memory-editor__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(93, 64, 55, 0.18);
  border-radius: 50%;
  background: rgba(246, 241, 231, 0.72);
  opacity: 1;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.memory-editor__back:hover {
  border-color: rgba(93, 64, 55, 0.34);
  background: var(--v-paper-bg);
  transform: translateX(-2px);
}

.memory-editor__back:focus-visible {
  outline: 2px solid var(--v-accent);
  outline-offset: 3px;
}

.memory-editor__heading {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.2;
}

.memory-editor__heading .vintage-date {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-editor__header > .vintage-actions {
  justify-self: end;
}

.memory-editor__header .vintage-btn {
  min-height: 42px;
  white-space: nowrap;
}

.memory-editor__eyebrow {
  font-family: var(--font-sans);
  color: var(--v-ink-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.memory-editor .vintage-paper {
  max-width: 860px;
  min-height: calc(100dvh - 130px);
  margin: 8px 0 0;
  padding: clamp(34px, 5vw, 64px) clamp(30px, 7vw, 76px);
  border: 1px solid rgba(93, 64, 55, 0.09);
  border-radius: 6px;
  box-shadow: 0 22px 60px rgba(62, 39, 35, 0.11);
}

.memory-editor .vintage-paper::before {
  margin-top: 136px;
  background-size: 100% 30px;
  opacity: 0.34;
}

.memory-journal-hint {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
  padding: 6px 10px;
  border: 1px solid rgba(139, 69, 19, 0.12);
  border-radius: 999px;
  background: rgba(200, 184, 154, 0.12);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
}

.memory-editor .vintage-title-input {
  margin-bottom: 22px;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.15;
}

.memory-editor .vintage-content {
  font-size: 17px;
  line-height: 1.75;
}

.memory-editor .vintage-content .ProseMirror {
  min-height: 62vh;
  caret-color: var(--v-accent);
  text-rendering: optimizeLegibility;
}

.memory-editor .vintage-content .ProseMirror p {
  margin-bottom: 0.85em;
}

.memory-editor .vintage-content .ProseMirror:focus-visible {
  outline: none;
}

.memory-editor .vintage-content .ProseMirror p.is-editor-empty:first-child::before {
  color: var(--v-ink-muted);
  opacity: 0.72;
}

.memory-editor .vintage-panel {
  height: 100dvh;
  overflow-y: auto;
  padding: 32px 26px 80px;
  background: #f3eee4;
}

.memory-editor .vintage-panel__header {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(93, 64, 55, 0.18);
}

.memory-editor .vintage-panel__header h2 {
  margin: 0;
  color: var(--v-ink-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.memory-editor .vintage-panel__header p {
  margin: 6px 0 0;
  color: var(--v-ink-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.5;
}

.memory-editor .vintage-drop-zone {
  min-height: 112px;
  flex-direction: column;
  gap: 5px;
  border-radius: 10px;
  background: rgba(246, 241, 231, 0.62);
  font-family: var(--font-sans);
}

.memory-editor .vintage-drop-zone small {
  color: var(--v-ink-muted);
  font-size: 10px;
}

.vintage-drop-zone__icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: rgba(139, 69, 19, 0.1);
  font-size: 20px;
}

.memory-editor__add-button {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px dashed var(--v-border);
  border-radius: 8px;
  background: rgba(246, 241, 231, 0.45);
  color: var(--v-accent);
  font-family: var(--font-sans);
  font-size: 13px;
}

.memory-editor__add-button:hover {
  border-style: solid;
  background: var(--v-paper-bg);
}

.memory-editor__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1024px) {
  .memory-editor {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: 1fr;
    height: 100dvh;
    overflow: hidden;
  }

  .memory-editor .vintage-panel {
    padding-inline: 20px;
    border-top: 0;
    border-left: 1px solid var(--v-border);
  }
}

@media (max-width: 768px) {
  body.vintage-theme {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .memory-editor {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .memory-editor .vintage-main {
    display: block;
    padding: 0;
    overflow: visible;
  }

  .memory-editor__header {
    display: grid;
    width: 100%;
    max-width: none;
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas: "back heading" "actions actions";
    gap: 12px;
    padding: 12px 16px;
    background: rgba(243, 238, 228, 0.96);
    border-bottom: 1px solid rgba(93, 64, 55, 0.12);
  }

  .memory-editor__back { grid-area: back; }
  .memory-editor__heading { grid-area: heading; }

  .memory-editor .vintage-date {
    font-size: 16px;
    text-align: left;
  }

  .memory-editor .vintage-actions {
    grid-area: actions;
    width: 100%;
    overflow: visible;
    padding: 0;
  }

  .memory-editor .vintage-actions .vintage-btn {
    min-width: 0;
    min-height: 44px;
    flex: 1 1 50%;
    padding-inline: 10px;
  }

  .memory-editor .vintage-paper {
    min-height: 70dvh;
    margin: 0;
    padding: 28px 22px 56px;
    border-radius: 0;
    box-shadow: none;
  }

  .memory-editor .vintage-paper::before { margin-top: 116px; }
  .memory-editor .vintage-title-input { font-size: 30px; }
  .memory-editor .vintage-content { font-size: 16px; line-height: 1.72; }
  .memory-editor .vintage-content .ProseMirror { min-height: 55vh; }

  .memory-editor .vintage-panel {
    height: auto;
    padding: 32px 20px calc(40px + env(safe-area-inset-bottom));
    overflow: visible;
    border: 0;
    border-top: 1px solid var(--v-border);
  }
}

@media (prefers-reduced-motion: reduce) {
  .memory-editor *,
  .memory-editor *::before,
  .memory-editor *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
