/* ==========================================================================
   TOKENS
   ========================================================================== */
:root {
  /* surfaces */
  --bg:           #0b0c0e;
  --bg-elev:      #141519;
  --bg-elev-2:    #1a1c21;

  /* lines */
  --line:         #232529;
  --line-soft:    #1b1c20;

  /* text */
  --text:         #eae7e1;
  --text-dim:     #93949a;
  --text-faint:   #5c5e64;

  /* category accents — the only colour in the whole page */
  --accent-personal: #e3a75e;
  --accent-academic: #5cc7be;
  --accent-business: #9c90e0;

  --radius: 3px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: 160ms;
  --dur-med: 380ms;
}

body[data-active="personal"] { --accent: var(--accent-personal); }
body[data-active="academic"] { --accent: var(--accent-academic); }
body[data-active="business"] { --accent: var(--accent-business); }

/* ==========================================================================
   RESET / BASE
   ========================================================================== */
* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.01em;
}

p { margin: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85em;
  color: var(--text-dim);
}

::selection { background: var(--accent); color: #101114; }

/* custom scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

/* ---------- Left rail ---------- */
.rail {
  border-right: 1px solid var(--line);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.rail-top {
  animation: fadeInUp 500ms var(--ease) both;
}

.mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  margin-bottom: 18px;
  transition: background var(--dur-med) var(--ease);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}

.wordmark {
  font-size: 22px;
  margin-bottom: 10px;
}

.tagline {
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.5;
  max-width: 22ch;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 48px 0;
  animation: fadeInUp 500ms var(--ease) 60ms both;
}

.tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  text-align: left;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.tab:hover { background: var(--bg-elev); }

.tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity var(--dur-fast) var(--ease);
}

.tab[data-cat="personal"] .tab-dot { background: var(--accent-personal); }
.tab[data-cat="academic"] .tab-dot { background: var(--accent-academic); }
.tab[data-cat="business"] .tab-dot { background: var(--accent-business); }

.tab-label {
  flex: 1;
  font-size: 14.5px;
  color: var(--text-dim);
  transition: color var(--dur-fast) var(--ease);
}

.tab-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  background: var(--bg-elev-2);
  border-radius: 20px;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}

.tab[aria-selected="true"] {
  background: var(--bg-elev);
}
.tab[aria-selected="true"] .tab-dot { opacity: 1; }
.tab[aria-selected="true"] .tab-label { color: var(--text); }
.tab[data-cat="personal"][aria-selected="true"] { border-left-color: var(--accent-personal); }
.tab[data-cat="academic"][aria-selected="true"] { border-left-color: var(--accent-academic); }
.tab[data-cat="business"][aria-selected="true"] { border-left-color: var(--accent-business); }

.rail-bottom {
  animation: fadeInUp 500ms var(--ease) 120ms both;
}

.hint {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.6;
  max-width: 24ch;
}

/* ---------- Main content ---------- */
.content {
  padding: 56px 64px 80px;
  max-width: 760px;
}

.content-header {
  margin-bottom: 40px;
  animation: fadeInUp 500ms var(--ease) both;
}

#categoryTitle {
  font-size: 30px;
  margin-bottom: 8px;
}

.content-sub {
  color: var(--text-faint);
  font-size: 14px;
}

/* ==========================================================================
   SPINE / TIMELINE
   ========================================================================== */
.spine {
  position: relative;
}

.spine.switching {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.entry {
  display: grid;
  grid-template-columns: 24px 1fr;
  column-gap: 18px;
  position: relative;
  animation: fadeInUp 460ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

/* connecting vertical line */
.entry::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 0;
  bottom: -28px;
  width: 1px;
  background: var(--line);
}

.entry:last-child::before {
  bottom: 50%;
}

.entry-thread {
  display: flex;
  justify-content: center;
  padding-top: 22px;
}

.entry-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--bg);
  position: relative;
  z-index: 1;
  transition: box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.entry-summary {
  width: 100%;
  text-align: left;
  padding: 18px 20px 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.entry:last-child .entry-summary { border-bottom: none; }

.entry-summary-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.entry-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.chevron {
  flex-shrink: 0;
  color: var(--text-faint);
  font-size: 13px;
  transition: transform var(--dur-med) var(--ease), color var(--dur-fast) var(--ease);
}

.entry-heading {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  transition: color var(--dur-fast) var(--ease);
}

.entry-excerpt {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.55;
  transition: opacity var(--dur-fast) var(--ease), max-height var(--dur-fast) var(--ease);
}

.entry-summary:hover .entry-heading { color: var(--accent); }
.entry:hover .entry-dot {
  box-shadow: 0 0 0 5px var(--bg), 0 0 0 7px color-mix(in srgb, var(--accent) 25%, transparent);
}

.entry-summary[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.entry-summary[aria-expanded="true"] .entry-excerpt {
  display: none;
}

/* expandable body — grid-rows trick, no JS height measuring needed */
.entry-body-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-med) var(--ease);
}

.entry-body-wrap.expanded {
  grid-template-rows: 1fr;
}

.entry-body-inner {
  overflow: hidden;
  min-height: 0;
}

.entry-body {
  padding: 2px 20px 26px 0;
  border-bottom: 1px solid var(--line-soft);
}

.entry:last-child .entry-body { border-bottom: none; }

.entry-body p {
  font-size: 14.5px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 14px;
}

.entry-body p:last-of-type { margin-bottom: 18px; }

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.entry-tags span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 4px 10px;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty-state {
  padding: 60px 0 40px;
  animation: fadeInUp 460ms var(--ease) both;
}

.empty-glyph {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-faint);
  font-size: 13px;
  margin-bottom: 14px;
}

.empty-text {
  font-family: 'Fraunces', serif;
  font-size: 19px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 13.5px;
  color: var(--text-faint);
  max-width: 42ch;
  line-height: 1.6;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }

  .rail {
    position: static;
    height: auto;
    justify-content: flex-start;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 20px 20px 0;
  }

  .rail-top { margin-bottom: 16px; }
  .mark { margin-bottom: 12px; }
  .wordmark { font-size: 19px; margin-bottom: 0; }
  .tagline { display: none; }

  .tabs {
    flex-direction: row;
    margin: 0;
    gap: 6px;
    overflow-x: auto;
  }

  .tab { border-left: none; border-bottom: 2px solid transparent; flex-shrink: 0; }
  .tab[data-cat="personal"][aria-selected="true"] { border-bottom-color: var(--accent-personal); border-left-color: transparent; }
  .tab[data-cat="academic"][aria-selected="true"] { border-bottom-color: var(--accent-academic); border-left-color: transparent; }
  .tab[data-cat="business"][aria-selected="true"] { border-bottom-color: var(--accent-business); border-left-color: transparent; }

  .rail-bottom { display: none; }

  .content { padding: 36px 20px 60px; }
  #categoryTitle { font-size: 24px; }
}

@media (max-width: 480px) {
  .entry { grid-template-columns: 16px 1fr; column-gap: 10px; }
  .entry::before { left: 7px; }
  .entry-dot { width: 7px; height: 7px; }
}
