/* ============================================
   SPODIC — Home / Library Page
   Monkeytype-inspired, product-first layout
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg, #141414);
  color: var(--text, #e0e0e0);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  padding-left: var(--nav-width, 56px);
}

.home-flash {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 320;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(520px, calc(100vw - 32px - var(--nav-width, 56px)));
  padding: 12px 14px;
  background: rgba(34, 18, 20, 0.94);
  border: 1px solid rgba(214, 57, 68, 0.28);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0,0,0,0.35);
  color: var(--text, #e0e0e0);
  transform: translate(-50%, -12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.home-flash.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.home-flash[data-type="error"] {
  background: rgba(34, 18, 20, 0.94);
  border-color: rgba(214, 57, 68, 0.28);
}

.home-flash-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(214, 57, 68, 0.16);
  color: var(--accent, #d63944);
}

.home-flash-message {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  line-height: 1.45;
}

.home-flash-close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-muted, #6b6b6b);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color 150ms ease-out, background 150ms ease-out;
}

.home-flash-close:hover {
  color: var(--text, #e0e0e0);
  background: rgba(255,255,255,0.06);
}

/* --- Layout --- */
.home-content {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
}

/* --- Fixed Avatar (top-right) --- */
.avatar-fixed {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 150;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-surface, #1e1e1e);
  color: var(--text-muted, #6b6b6b);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease-out, color 150ms ease-out;
}
.avatar-fixed:hover {
  background: var(--control-hover, rgba(255,255,255,0.08));
  color: var(--text, #e0e0e0);
}

/* Account dropdown (anchored from top-right) */
.account-dropdown {
  position: fixed;
  top: 56px;
  right: 20px;
  min-width: 220px;
  background: var(--bg-surface, #1e1e1e);
  border: 1px solid var(--control-border, rgba(255,255,255,0.06));
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease-out;
  overflow: hidden;
}
.account-dropdown.open {
  opacity: 1;
  pointer-events: auto;
}

.dropdown-user {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--control-border, rgba(255,255,255,0.06));
}
.dropdown-user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text, #e0e0e0);
}
.dropdown-user-email {
  font-size: 0.75rem;
  color: var(--text-muted, #6b6b6b);
  margin-top: 1px;
}

.dropdown-items { padding: 6px 0; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 16px;
  background: none;
  border: none;
  color: var(--text, #e0e0e0);
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease-out;
}
.dropdown-item:hover {
  background: var(--control-hover, rgba(255,255,255,0.08));
}

.dropdown-item.upgrade {
  color: var(--accent, #d63944);
}
.dropdown-item .sparkle {
  font-size: 0.6875rem;
  opacity: 0.7;
}

.dropdown-divider {
  height: 1px;
  background: var(--control-border, rgba(255,255,255,0.06));
  margin: 4px 0;
}

/* Logo — removed (now in sidebar) */

/* Settings gear — removed (now in sidebar) */


/* --- Section labels --- */
.section-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-subtle, #3a3a3a);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}


/* --- Continue Reading Card --- */
.continue-section { margin-bottom: 32px; }

.continue-card {
  position: relative;
  background: var(--bg-surface, #1e1e1e);
  border: 1px solid var(--control-border, rgba(255,255,255,0.06));
  border-radius: 12px;
  padding: 28px 32px;
  cursor: pointer;
  transition: border-color 150ms ease-out, background 150ms ease-out;
  overflow: hidden;
}
.continue-card:hover {
  border-color: var(--control-hover, rgba(255,255,255,0.08));
  background: var(--bg-surface, #1e1e1e);
  filter: brightness(1.04);
}

.continue-card-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.continue-card-title {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text, #e0e0e0);
  margin-bottom: 8px;
}

.continue-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-muted, #6b6b6b);
}
.continue-card-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-subtle, #3a3a3a);
  flex-shrink: 0;
}

.continue-arrow {
  color: var(--text-muted, #6b6b6b);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 150ms ease-out, transform 150ms ease-out;
  flex-shrink: 0;
  margin-top: 4px;
}
.continue-card:hover .continue-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Progress bar at card bottom */
.continue-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
}
.continue-progress-fill {
  height: 100%;
  background: var(--accent, #d63944);
  border-radius: 0 0 0 12px;
  transition: width 300ms ease-out;
}


/* --- Input Zone --- */
.input-section { margin-bottom: 24px; }

.home-wordmark {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  margin: clamp(-110px, -16vh, -42px) 0 100px;
  color: var(--text, #e0e0e0);
  font-family: var(--app-font-family, 'Inter', system-ui, sans-serif);
  font-size: clamp(2rem, 7vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  user-select: none;
  pointer-events: none;
  opacity: 0.92;
}

body.home-has-continue .home-wordmark {
  margin: clamp(-150px, -22vh, -70px) 0 100px;
}

.home-wordmark-text {
  color: var(--text, #e0e0e0);
}

.home-wordmark-o-wrap {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  margin: 0 0.05em;
}

.home-wordmark-o {
  color: var(--orp-color, var(--accent, #d63944));
}

.home-wordmark-guide {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: 0.28em;
  width: 1px;
  background: var(--guide-color, rgba(200, 200, 200, 0.3));
  opacity: 0.9;
}

.home-wordmark-guide-left {
  top: -0.18em;
}

.home-wordmark-guide-right {
  bottom: -0.32em;
}

.input-textarea {
  display: block;
  width: 100%;
  min-height: 140px;
  padding: 20px;
  background: var(--bg-input, #0f0f0f);
  border: 1px dashed var(--control-border, rgba(255,255,255,0.06));
  border-radius: 12px;
  color: var(--text, #e0e0e0);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color 150ms ease-out, border-style 150ms ease-out;
}
.input-textarea::placeholder {
  color: var(--text-subtle, #3a3a3a);
}
.input-textarea:focus {
  border-style: solid;
  border-color: var(--accent, #d63944);
}

/* Drag-over state */
.input-textarea.drag-over {
  border-style: solid;
  border-color: var(--accent, #d63944);
}

/* File info banner */
.file-info {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-top: 8px;
  background: var(--accent-dim, rgba(214,57,68,0.08));
  border: 1px solid var(--control-border, rgba(255,255,255,0.06));
  border-radius: 8px;
  font-size: 0.8125rem;
  color: var(--text, #e0e0e0);
}
.file-info.visible { display: flex; }
.file-info-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-info-remove {
  background: none;
  border: none;
  color: var(--text-muted, #6b6b6b);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 2px;
  line-height: 1;
  transition: color 150ms ease-out;
}
.file-info-remove:hover { color: var(--text, #e0e0e0); }

/* URL hint */
.url-hint {
  display: none;
  font-size: 0.75rem;
  color: var(--text-muted, #6b6b6b);
  margin-top: 8px;
}
.url-hint.visible { display: block; }
.url-hint a {
  color: var(--accent, #d63944);
  text-decoration: none;
}
.url-hint a:hover { text-decoration: underline; }

/* Action row below textarea */
.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 12px;
  flex-wrap: wrap;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-muted, #6b6b6b);
}
.input-hint kbd {
  display: inline-block;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: inherit;
}

.input-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Ghost button (Upload) */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--control-border, rgba(255,255,255,0.06));
  border-radius: 8px;
  background: none;
  color: var(--text-muted, #6b6b6b);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: color 150ms ease-out, border-color 150ms ease-out;
}
.btn-ghost:hover {
  color: var(--text, #e0e0e0);
  border-color: var(--control-hover, rgba(255,255,255,0.08));
}
.btn-ghost svg {
  width: 14px;
  height: 14px;
}

/* Spood AI button */
.btn-ai {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--accent-glow, rgba(214,57,68,0.12));
  border-radius: 8px;
  background: var(--accent-dim, rgba(214,57,68,0.08));
  color: var(--accent, #d63944);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 150ms ease-out;
}
.btn-ai:hover {
  background: var(--accent-glow, rgba(214,57,68,0.12));
}
.btn-ai .sparkle { font-size: 0.75rem; }

/* Read button (primary) */
.btn-read {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent, #d63944);
  color: #fff;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease-out, filter 150ms ease-out;
}
.btn-read.visible {
  opacity: 1;
  pointer-events: auto;
}
.btn-read:hover {
  filter: brightness(1.1);
}


/* --- Recent Items — removed (moved to Library page) --- */


/* --- Recents Strip (compact footer) --- */
.home-recents-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-bottom: 16px;
}

.recents-strip-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  text-decoration: none;
  color: var(--text-muted, #6b6b6b);
  font-size: 0.75rem;
  transition: color 150ms ease-out;
  width: 100%;
  border-bottom: 1px solid var(--control-border, rgba(255,255,255,0.06));
}
.recents-strip-item:first-child {
  border-top: 1px solid var(--control-border, rgba(255,255,255,0.06));
}
.recents-strip-item:hover {
  color: var(--text, #e0e0e0);
}

.recents-strip-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.recents-strip-meta {
  flex-shrink: 0;
  color: var(--text-subtle, #3a3a3a);
  font-size: 0.6875rem;
}

.recents-strip-more {
  display: inline-block;
  padding: 6px 0;
  font-size: 0.75rem;
  color: var(--accent, #d63944);
  text-decoration: none;
  transition: opacity 150ms ease-out;
}
.recents-strip-more:hover {
  opacity: 0.8;
}


/* Empty state */
.empty-state {
  text-align: center;
  color: var(--text-subtle, #3a3a3a);
  font-size: 0.875rem;
  padding: 32px 0;
}


/* --- Footer --- */
.home-footer {
  padding: 16px 0 24px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-subtle, #3a3a3a);
  letter-spacing: 0.04em;
}


/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.anim-section {
  opacity: 0;
  animation: fadeInUp 400ms ease-out forwards;
}
.anim-section:nth-child(1) { animation-delay: 0ms; }
.anim-section:nth-child(2) { animation-delay: 80ms; }
.anim-section:nth-child(3) { animation-delay: 160ms; }
.anim-section:nth-child(4) { animation-delay: 240ms; }
.anim-section:nth-child(5) { animation-delay: 320ms; }
.anim-section:nth-child(6) { animation-delay: 400ms; }

/* --- Sign-In Modal --- */
.signin-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 150ms ease;
}

.signin-overlay.open {
  display: flex !important;
}

.signin-modal {
  background: var(--bg-secondary, #1e1e1e);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  position: relative;
  animation: slideUp 200ms ease;
}

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

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

.signin-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-secondary, #888);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.signin-close:hover {
  color: var(--text-primary, #e8e8e8);
  background: var(--bg-hover, rgba(255,255,255,0.05));
}

.signin-step h3 {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary, #e8e8e8);
}

.signin-subtitle {
  color: var(--text-secondary, #888);
  font-size: 0.875rem;
  margin: 0 0 1.25rem;
}

.signin-input-group {
  display: flex;
  gap: 8px;
}

.signin-email {
  flex: 1;
  background: var(--bg-primary, #141414);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 8px;
  padding: 0.625rem 0.75rem;
  color: var(--text-primary, #e8e8e8);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 150ms;
}

.signin-email:focus {
  border-color: var(--accent, #d63944);
}

.signin-email::placeholder {
  color: var(--text-tertiary, #555);
}

.signin-submit {
  background: var(--accent, #d63944);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.625rem 1rem;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 150ms;
}

.signin-submit:hover { opacity: 0.9; }
.signin-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.signin-error {
  color: var(--accent, #d63944);
  font-size: 0.8125rem;
  margin: 0.5rem 0 0;
  min-height: 1.25rem;
}

/* Sent state */
.signin-sent-icon {
  color: var(--accent, #d63944);
  margin-bottom: 0.75rem;
}

.signin-hint {
  color: var(--text-tertiary, #666);
  font-size: 0.8125rem;
  margin-top: 1rem;
}

.signin-link-btn {
  background: none;
  border: none;
  color: var(--accent, #d63944);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  padding: 0;
}

/* --- Anonymous State (no user) --- */
.avatar-fixed.anon {
  background: var(--bg-secondary, #1e1e1e);
  border: 1px dashed var(--border, rgba(255,255,255,0.15));
  color: var(--text-secondary, #888);
  font-size: 0.75rem;
}

.avatar-fixed.anon:hover {
  border-color: var(--accent, #d63944);
  color: var(--accent, #d63944);
}


/* --- Responsive --- */
@media (max-width: 600px) {
  .home-flash {
    top: 12px;
    width: calc(100vw - 24px);
    padding: 11px 12px;
  }

  .home-content {
    padding: 0 16px 48px;
  }

  .input-textarea {
    min-height: 100px;
  }

  .home-wordmark {
    margin: -34px 0 12px;
  }

  body.home-has-continue .home-wordmark {
    margin: -56px 0 12px;
  }

  .input-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .input-buttons {
    width: 100%;
    justify-content: flex-end;
  }

  .account-dropdown {
    right: 12px;
    min-width: 200px;
  }
}

/* --- Light theme adjustments (Paper, Sakura) --- */
[data-theme="paper"] .account-dropdown,
[data-theme="sakura"] .account-dropdown,
[data-theme="flower"] .account-dropdown {
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
[data-theme="paper"] .input-hint kbd,
[data-theme="sakura"] .input-hint kbd,
[data-theme="flower"] .input-hint kbd {
  background: rgba(0,0,0,0.05);
}
[data-theme="paper"] .btn-read {
  color: #fff;
}
[data-theme="sakura"] .btn-read,
[data-theme="flower"] .btn-read {
  color: #fff;
}
