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

:root {
  --bg: #f5f2eb;
  --surface: #ede9e0;
  --border: #c8c2b4;
  --text: #1a1a2e;
  --text-dim: #3a3a5c;
  --text-bright: #0a0a1a;
  --accent: #e63;
  --tag-bg: #ede9e0;
  --mono: 'DM Mono', monospace;
  --display: 'Playwrite GB J Guides', cursive;
  --overlay-bg: rgba(245, 242, 235, 0);
  --header-bg: rgba(245, 242, 235, 0.55);
  --footer-bg: rgba(245, 242, 235, 0.75);
  --list-w: 320px;
  --strip-w: 28px;
}

[data-theme="dark"] {
  --bg: #0e0e0e;
  --surface: #141414;
  --border: #262626;
  --text: #cecdcd;
  --text-dim: #cecccc;
  --text-bright: #efefef;
  --accent: #e63;
  --tag-bg: #1a1a1a;
  --overlay-bg: rgba(10, 10, 14, 0.1);
  --header-bg: rgba(10, 10, 14, 0.75);
  --footer-bg: rgba(10, 10, 14, 0.75);
}

html, body { height: 100%; }

body {
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  transition: background 0.2s, color 0.2s;
  position: relative;
}

body.split-view { overflow: hidden; }

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: -1;
  transition: background 0.2s;
}

a { color: inherit; text-decoration: none; }

/* ── HEADER ── */
header {
  padding: 2rem 2.5rem 1.5rem;
  border-bottom: 1px solid var(--text-bright);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: border-color 0.2s, background 0.2s;
  background: var(--header-bg);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

header.compact {
  padding: 1.5rem 2rem 1rem;
}

.site-name {
  font-family: var(--display);
  font-size: 1.3rem;
  color: var(--text-bright);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.site-name a:hover { opacity: 0.6; }

nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

.nav-links { display: flex; gap: 1.25rem; }

nav a {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: none;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}

nav a:hover, nav a.active { color: var(--accent); }

.header-right { margin-left: auto; display: flex; align-items: center; }

.theme-btn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  padding: 0.25rem 0.65rem;
  margin-left: auto;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.6;
}
.theme-btn:hover { color: var(--text-bright); border-color: var(--text-dim); }

/* ── SPLIT LAYOUT ── */
.split {
  flex: 1;
  display: grid;
  grid-template-columns: var(--list-w) var(--strip-w) 1fr;
  overflow: hidden;
  transition: grid-template-columns 0.3s cubic-bezier(0.4,0,0.2,1);
}
.split.list-collapsed    { grid-template-columns: 0px var(--strip-w) 1fr; }
.split.content-collapsed { grid-template-columns: 1fr var(--strip-w) 0px; }

/* ── COLLAPSE STRIP ── */
.collapse-strip {
  width: var(--strip-w);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 10;
  flex-shrink: 0;
}

.collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  transition: color 0.15s;
}
.collapse-btn:hover { color: var(--accent); }
.collapse-btn svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.strip-label {
  font-size: 0.5rem;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  user-select: none;
}
.split.list-collapsed    .strip-label.for-list    { opacity: 1; }
.split.content-collapsed .strip-label.for-content { opacity: 1; }

/* ── LEFT PANEL ── */
.panel-list {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s;
  min-width: 0;
}
.split.list-collapsed .panel-list { opacity: 0; pointer-events: none; }

.panel-list-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.panel-list-inner::-webkit-scrollbar { width: 3px; }
.panel-list-inner::-webkit-scrollbar-thumb { background: var(--border); }

/* ── FILTERS ── */
.filters {
  padding: 1.25rem 1.5rem 0.9rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.filter-search { position: relative; margin-bottom: 0.65rem; }
.search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  display: flex;
}
.search-icon svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.filter-search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-bright);
  padding: 0.38rem 0.7rem 0.38rem 1.85rem;
  outline: none;
  font-weight: 300;
  transition: border-color 0.15s;
}
.filter-search input::placeholder { color: var(--text-dim); }
.filter-search input:focus { border-color: var(--text-dim); }

.filter-row { display: flex; gap: 0.4rem; align-items: center; }

.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  padding: 0.3rem 0.5rem;
  outline: none;
  cursor: pointer;
  font-weight: 300;
  flex: 1;
  min-width: 0;
  transition: border-color 0.15s;
}
.filter-select:focus { border-color: var(--text-dim); }

.filter-clear {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.35rem;
  transition: color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-clear:hover { color: var(--accent); }
.filter-clear.hidden { visibility: hidden; }

/* ── PANEL HEADER ── */
.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.9rem 1.5rem 0.75rem;
  flex-shrink: 0;
}
.panel-label { font-size: 0.62rem; color: var(--text-dim); letter-spacing: 0.12em; text-transform: uppercase; }
.item-count  { font-size: 0.58rem; color: var(--text-dim); letter-spacing: 0.04em; }

/* ── LIST ITEMS ── */
.item-list { list-style: none; }

.list-item {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.list-item:last-child { border-bottom: 1px solid var(--border); }
.list-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.15s ease;
}
.list-item:hover::before, .list-item.active::before { transform: scaleY(1); }
.list-item:hover { background: var(--surface); }
.list-item.active { background: var(--surface); }
.list-item.active .item-title { color: var(--accent); }

.item-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.28rem;
}
.item-title {
  font-size: 0.82rem;
  color: var(--text-bright);
  font-weight: 400;
  line-height: 1.4;
  transition: color 0.12s;
}
.list-item:hover .item-title { color: var(--accent); }

.item-index {
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}
.item-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.tag {
  font-size: 0.58rem;
  color: var(--text-dim);
  background: var(--tag-bg);
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.tag:hover        { color: var(--accent); border-color: var(--accent); }
.tag.active-tag   { color: var(--accent); border-color: var(--accent); }

/* ── RIGHT PANEL ── */
.panel-content {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  transition: opacity 0.2s;
  min-width: 0;
}
.panel-content::-webkit-scrollbar { width: 3px; }
.panel-content::-webkit-scrollbar-thumb { background: var(--border); }
.split.content-collapsed .panel-content { opacity: 0; pointer-events: none; }

.content-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: var(--text-dim);
}
.content-empty .hint  { font-size: 0.7rem; letter-spacing: 0.08em; }
.content-empty .arrow { font-size: 1.2rem; opacity: 0.3; }

/* ── SINGLE VIEW ── */
.single-view {
  padding: 3rem 4rem 4rem;
  max-width: 860px;
  margin: 0 auto;
  display: none;
}
.single-view.visible { display: block; }

.single-title {
  font-family: var(--mono);
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  color: var(--text-bright);
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}
.single-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.single-date { font-size: 0.67rem; color: var(--text-dim); }
.divider { color: var(--border); font-size: 0.8rem; }
.single-content { font-size: 0.82rem; color: var(--text); line-height: 1.9; }
.single-content p { margin-bottom: 1.4rem; }

.visit-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-bright);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}
.visit-link:hover { color: var(--accent); border-color: var(--accent); }

/* ── FOOTER ── */
footer {
  padding: 0.9rem 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  background: var(--footer-bg);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

footer.simple {
  padding: 1.5rem 2.5rem;
}

/* ── MISC ── */
.no-results { font-size: 0.72rem; color: var(--text-dim); padding: 2rem 1.5rem; }
.loading    { font-size: 0.72rem; color: var(--text-dim); padding: 1.5rem; }

.fade-in { animation: fadeIn 0.2s ease forwards; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── MOBILE ── */
@media (max-width: 700px) {
  html, body { height: auto; overflow: auto; }
  .split { grid-template-columns: 1fr !important; overflow: visible; }
  .collapse-strip { display: none; }
  .panel-list { overflow: visible; }
  .panel-list-inner { overflow: visible; max-height: none; }
  .panel-content { overflow: visible; }
  .single-view { padding: 2rem 1.5rem 3rem; max-width: 100%; }
  header { flex-direction: column; gap: 0.75rem; padding: 1.5rem 1.5rem 1.25rem; }
  footer { padding: 1rem 1.5rem; }
}
