/* ============================================
   TOKENS
   ============================================ */
:root {
  /* Colors */
  --color-bg-primary:     #1F1F1F;
  --color-bg-elevated:    #242424;
  --color-bg-card:        #2C2C2C;
  --color-accent:         #4B3737;
  --color-text-primary:   #F9F9F9;
  --color-text-secondary: #9E9E9E;
  --color-text-inactive:  #606060;
  --color-border:         #3B3B3B;
  --color-nav-indicator:  #D9D9D9;

  /* Fonts */
  --font-sans: system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  /* Font sizes */
  --font-size-xs:   12px;
  --font-size-base: 16px;
  --font-size-xl:   28px;
  --font-size-2xl:  40px;

  /* Line heights */
  --line-height-tight: 1.2;
  --line-height-snug:  1.3;
  --line-height-body:  24px;

  /* Spacing */
  --space-xxxs: 4px;
  --space-xxs:  8px;
  --space-xs:   16px;
  --space-sm:   24px;
  --space-md:   32px;
  --space-lg:   40px;
  --space-lg2:  48px;
  --space-xl:   64px;
  --space-xxl:  96px;

  /* Border radius */
  --radius-sm:   4px;
  --radius-md:   16px;
  --radius-full: 50%;

  /* Layout */
  --nav-width:          100px;
  --sidebar-width:      409px;
  --content-max:        663px;
  --avatar-size:        107px;
  --placeholder-height: 420px;
  --mobile-nav-height:  90px;

  /* Gaps */
  --gap-nav-tab: 8px;

}

/* ============================================
   RESET
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

/* ============================================
   NAV RAIL
   ============================================ */
.nav-rail {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-width);
  height: 100vh;
  background: var(--color-bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) 0 var(--space-sm);
  z-index: 100;
}

.nav-tabs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg2);
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-nav-tab);
  cursor: pointer;
  color: var(--color-text-secondary);
}

.nav-tab[aria-current="page"] { color: var(--color-text-primary); }

.nav-indicator { display: none; }

.nav-tab svg { color: inherit; }

.nav-label { display: none; }

/* ============================================
   HOME LAYOUT
   ============================================ */
.home-main {
  margin-left: var(--nav-width);
  padding: var(--space-xl) var(--space-xl) var(--space-xxl);
}

.home-content {
  max-width: var(--content-max);
  margin: 0 auto;
}

.intro { margin-bottom: var(--space-xl); }

.intro-avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: var(--radius-full);
  background: var(--color-bg-card);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.intro-avatar img { width: 100%; height: 100%; object-fit: cover; }

.intro-name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xxs);
}

.intro-bio {
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  color: var(--color-text-secondary);
}

.section { margin-bottom: var(--space-xxl); }

.section-divider {
  height: 1px;
  background: var(--color-border);
  margin-bottom: var(--space-xl);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.section-title {
  font-weight: 700;
  font-size: var(--font-size-xl);
  color: var(--color-text-primary);
}

.view-all {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
}

.view-all:hover { color: var(--color-text-primary); }

.item-list {}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
  color: inherit;
}

.list-item-content { flex: 1; min-width: 0; }

.list-item-title {
  font-weight: 700;
  font-size: var(--font-size-base);
  line-height: var(--line-height-snug);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xxs);
}

.list-item-tags {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-xxs);
}

.tag {
  background: var(--color-accent);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-xxs);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-body);
  color: var(--color-text-secondary);
}

.list-item-desc {
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   LIST ROW PATTERN — chevron animates right on hover.
   Apply .list-item-chevron to any row's chevron icon
   and this pattern handles the rest.
   ============================================ */
.list-item-chevron {
  flex-shrink: 0;
  color: var(--color-text-secondary);
  transition: transform 0.2s ease;
}

.list-item:hover .list-item-chevron,
.sidebar-item:hover .list-item-chevron {
  transform: translateX(var(--space-xxs));
}


/* ============================================
   CONNECT GRID
   ============================================ */
.connect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.connect-grid-item {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
  padding: var(--space-sm) 0;
  color: var(--color-text-secondary);
  font-weight: 700;
  font-size: var(--font-size-base);
  transition: color 0.15s;
}

.connect-grid-item:hover { color: var(--color-text-primary); }

/* ============================================
   WORK / WRITING LAYOUT
   ============================================ */
body.two-col-page { overflow: hidden; }

.two-col-layout {
  display: flex;
  height: 100vh;
  margin-left: var(--nav-width);
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-bg-elevated);
  height: 100vh;
  overflow-y: auto;
  transition: margin-left 0.3s ease, opacity 0.15s ease;
}

.two-col-layout.sidebar-collapsed .sidebar {
  margin-left: calc(-1 * var(--sidebar-width));
  opacity: 0;
}

.nav-sidebar-toggle {
  margin-top: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  padding: var(--space-sm) 0;
  transition: color 0.15s;
}
.nav-sidebar-toggle:hover { color: var(--color-text-primary); }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xl) var(--space-sm) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.sidebar-header-label {
  font-weight: 700;
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  position: relative;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.sidebar-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-xs);
  right: var(--space-xs);
  height: 1px;
  background: var(--color-border);
}

.sidebar-item.active  { opacity: 1; }
.sidebar-item:hover   { opacity: 0.8; }
.sidebar-item.active:hover { opacity: 1; }

.sidebar-item-content { flex: 1; min-width: 0; }

.sidebar-item-title {
  font-weight: 700;
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xxxs);
}

.sidebar-item-desc {
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  color: var(--color-text-secondary);
}

.sidebar-item svg { flex-shrink: 0; color: var(--color-text-secondary); }

.detail-panel {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  padding: var(--space-xl);
}

.detail-content { display: none; max-width: var(--content-max); margin: 0 auto; }
.detail-content.active { display: block; }

.detail-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.detail-desc {
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
}

.detail-section-label {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.detail-section-body {
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

.detail-placeholder {
  width: 100%;
  min-height: var(--placeholder-height);
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xl);
}

/* ============================================
   RESPONSIVE — bottom tab bar
   ============================================ */
@media (max-width: 768px) {
  .nav-rail {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    padding: var(--space-xxs) var(--space-sm);
    border-top: 1px solid var(--color-border);
  }

  .nav-tabs {
    flex-direction: row;
    gap: 0;
    width: 100%;
    justify-content: space-around;
  }

  .nav-indicator { display: none !important; }

  .home-main {
    margin-left: 0;
    padding-bottom: var(--mobile-nav-height);
  }

  body.two-col-page { overflow: auto; }

  .two-col-layout {
    flex-direction: column;
    height: auto;
    margin-left: 0;
  }

  .sidebar { width: 100%; height: auto; overflow-y: visible; }

  .detail-panel {
    height: auto;
    overflow-y: visible;
    padding-bottom: var(--mobile-nav-height);
  }
}
