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

:root {
  --bg:          #14121e;
  --bg-sidebar:  #0f0d18;
  --bg-card:     #1e1b2e;
  --bg-section:  #1a1828;
  --border:      #2e2a45;
  --accent:      #b89a5e;
  --accent-dim:  #7a6640;
  --text:        #d4cbb8;
  --text-muted:  #7a7490;
  --text-heading:#e8dfc5;
  --highlight:   #2a2545;
  --sidebar-w:   240px;
  --radius:      6px;
  --font-serif:  Georgia, 'Times New Roman', serif;
  --font-sans:   system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Layout ───────────────────────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-title {
  padding: 18px 16px 12px;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-search {
  margin: 10px 12px;
  padding: 7px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  flex-shrink: 0;
}
.sidebar-search::placeholder { color: var(--text-muted); }
.sidebar-search:focus { border-color: var(--accent-dim); }

.card-nav {
  overflow-y: auto;
  flex: 1;
  padding-bottom: 16px;
}
.card-nav::-webkit-scrollbar { width: 5px; }
.card-nav::-webkit-scrollbar-track { background: transparent; }
.card-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.nav-section-header {
  padding: 12px 14px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-dim);
}

.nav-item {
  display: block;
  width: 100%;
  padding: 6px 14px 6px 20px;
  background: none;
  border: none;
  text-align: left;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover {
  color: var(--text);
  background: var(--highlight);
}
.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--highlight);
}

.nav-item-img { display: none; }

/* ── Main content ─────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
}
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Welcome ──────────────────────────────────────────────── */
.welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60vh;
  color: var(--text-muted);
  font-size: 1rem;
  font-style: italic;
}

/* ── Card detail ──────────────────────────────────────────── */
.card-detail { max-width: 820px; }

.hidden { display: none !important; }

/* ── Detail header ────────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.detail-number {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--accent-dim);
  min-width: 2rem;
}

.detail-name {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: normal;
  color: var(--text-heading);
  letter-spacing: 0.04em;
}

.detail-suit {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Slideshow ────────────────────────────────────────────── */
.slideshow-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
}

.slideshow-viewport {
  flex: 1;
  overflow: hidden;
  border-radius: var(--radius);
}

.slideshow-track {
  display: flex;
  gap: 14px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-item {
  flex-shrink: 0;
  /* Playing-card proportion ~63mm × 88mm ≈ 2:2.8 ratio */
  width: calc((100% - 28px) / 3);
  aspect-ratio: 5 / 7;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slide-item .img-placeholder {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 8px;
}

.slide-arrow {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}
.slide-arrow:hover { color: var(--accent); border-color: var(--accent-dim); }
.slide-arrow:disabled { opacity: 0.25; cursor: default; }

/* ── Sections ─────────────────────────────────────────────── */
.section {
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.section h2 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: normal;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Owen's notes ─────────────────────────────────────────── */
.owens-notes {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  color: var(--text);
  white-space: pre-wrap;
  margin-bottom: 16px;
  min-height: 1rem;
}

.owens-notes:empty::before {
  content: 'No notes yet.';
  color: var(--text-muted);
  font-style: italic;
}

.add-note-form {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

#note-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 0.92rem;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  line-height: 1.5;
}
#note-input:focus { border-color: var(--accent-dim); }
#note-input::placeholder { color: var(--text-muted); font-style: italic; }

.add-note-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.btn-save {
  padding: 8px 18px;
  background: transparent;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-save:hover { background: var(--highlight); border-color: var(--accent); }

.save-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  transition: opacity 0.3s;
}
.save-status.ok  { color: #6aaa6a; }
.save-status.err { color: #cc6666; }

/* ── Black Shadow text ────────────────────────────────────── */
.black-shadow-text {
  font-family: var(--font-serif);
  font-size: 0.93rem;
  color: var(--text);
  line-height: 1.8;
  white-space: pre-wrap;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 720px) {
  .sidebar { width: 180px; min-width: 180px; }
  .main { padding: 20px 18px; }
  .slide-item { width: calc((100% - 14px) / 2); }
}

@media (max-width: 520px) {
  .layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    min-width: unset;
    height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .card-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
  }
  .card-nav::-webkit-scrollbar { height: 4px; }

  .nav-section-header { display: none; }

  .nav-item {
    flex-shrink: 0;
    width: 10%;
    aspect-ratio: 5 / 7;
    padding: 0;
    border: 2px solid transparent;
    border-left: 2px solid transparent;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
  }
  .nav-item:hover { background: var(--bg-card); }
  .nav-item.active { border-color: var(--accent); background: var(--bg-card); }

  .nav-item span { display: none; }
  .nav-item-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .black-shadow-text,
  .owens-notes { font-size: 1.1rem; line-height: 1.75; }

  .main { padding: 20px 16px; }
}
